Skip to content

Commit 5f7f790

Browse files
committed
rlc: switching latency measurments to use steady_clock
1 parent 4d168c1 commit 5f7f790

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

lib/rlc/rlc_rx_am_entity.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void rlc_rx_am_entity::handle_data_pdu(byte_buffer_slice buf)
208208
} else {
209209
logger.log_info("RX SDU. sn={} sdu_len={}", header.sn, sdu.value().length());
210210
metrics.metrics_add_sdus(1, sdu.value().length());
211-
auto latency = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() -
211+
auto latency = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() -
212212
sdu_info.time_of_arrival);
213213
metrics.metrics_add_sdu_latency(latency.count() / 1000);
214214
upper_dn.on_new_sdu(std::move(sdu.value()));
@@ -333,7 +333,7 @@ bool rlc_rx_am_entity::handle_full_data_sdu(const rlc_am_pdu_header& header, byt
333333
// Add new SN to RX window if no segments have been received yet
334334
rlc_rx_am_sdu_info& rx_sdu = rx_window->has_sn(header.sn) ? (*rx_window)[header.sn] : ([&]() -> rlc_rx_am_sdu_info& {
335335
rlc_rx_am_sdu_info& sdu = rx_window->add_sn(header.sn);
336-
sdu.time_of_arrival = std::chrono::high_resolution_clock::now();
336+
sdu.time_of_arrival = std::chrono::steady_clock::now();
337337
return sdu;
338338
})();
339339

@@ -357,7 +357,7 @@ bool rlc_rx_am_entity::handle_segment_data_sdu(const rlc_am_pdu_header& header,
357357
// Add new SN to RX window if no segments have been received yet
358358
rlc_rx_am_sdu_info& rx_sdu = rx_window->has_sn(header.sn) ? (*rx_window)[header.sn] : ([&]() -> rlc_rx_am_sdu_info& {
359359
rlc_rx_am_sdu_info& sdu = rx_window->add_sn(header.sn);
360-
sdu.time_of_arrival = std::chrono::high_resolution_clock::now();
360+
sdu.time_of_arrival = std::chrono::steady_clock::now();
361361
return sdu;
362362
})();
363363

lib/rlc/rlc_rx_am_entity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct rlc_rx_am_sdu_info {
4545
/// Buffer for either a full SDU or a set of SDU segments.
4646
std::variant<byte_buffer_slice, segment_set_t> sdu_data;
4747
/// Time of arrival of the first segment of the SDU.
48-
std::chrono::system_clock::time_point time_of_arrival;
48+
std::chrono::steady_clock::time_point time_of_arrival;
4949
};
5050

5151
/// \brief Rx state variables

lib/rlc/rlc_rx_um_entity.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rlc_rx_um_entity::rlc_rx_um_entity(gnb_du_id_t gnb_du_id,
4747
void rlc_rx_um_entity::handle_pdu(byte_buffer_slice buf)
4848
{
4949
metrics.metrics_add_pdus(1, buf.length());
50-
auto start = std::chrono::high_resolution_clock::now();
50+
auto start = std::chrono::steady_clock::now();
5151
pcap.push_pdu(pcap_context, buf);
5252

5353
rlc_um_pdu_header header = {};
@@ -81,8 +81,7 @@ void rlc_rx_um_entity::handle_pdu(byte_buffer_slice buf)
8181
// deliver to upper layer
8282
logger.log_info("RX SDU. sdu_len={}", sdu.value().length());
8383
metrics.metrics_add_sdus(1, sdu.value().length());
84-
auto latency =
85-
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - start);
84+
auto latency = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() - start);
8685
metrics.metrics_add_sdu_latency(latency.count() / 1000);
8786
upper_dn.on_new_sdu(std::move(sdu.value()));
8887
// Nothing else to do here ...
@@ -118,7 +117,7 @@ void rlc_rx_um_entity::handle_pdu(byte_buffer_slice buf)
118117
// Do not pass empty SDU to upper layers and continue as normal to maintain state
119118
} else {
120119
logger.log_info("RX SDU. sn={} sdu_len={}", header.sn, sdu.value().length());
121-
auto latency = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() -
120+
auto latency = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() -
122121
sdu_info.time_of_arrival);
123122
metrics.metrics_add_sdu_latency(latency.count() / 1000);
124123
metrics.metrics_add_sdus(1, sdu.value().length());
@@ -282,7 +281,7 @@ bool rlc_rx_um_entity::handle_segment_data_sdu(const rlc_um_pdu_header& header,
282281
// Add new SN to RX window if no segments have been received yet
283282
rlc_rx_um_sdu_info& rx_sdu = rx_window->has_sn(header.sn) ? (*rx_window)[header.sn] : ([&]() -> rlc_rx_um_sdu_info& {
284283
rlc_rx_um_sdu_info& sdu = rx_window->add_sn(header.sn);
285-
sdu.time_of_arrival = std::chrono::high_resolution_clock::now();
284+
sdu.time_of_arrival = std::chrono::steady_clock::now();
286285
return sdu;
287286
})();
288287
// Create SDU segment, to be stored later

lib/rlc/rlc_rx_um_entity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct rlc_rx_um_sdu_info {
4444
/// Buffer for set of SDU segments.
4545
segment_set_t segments;
4646
/// Time of arrival of the first segment of the SDU.
47-
std::chrono::system_clock::time_point time_of_arrival;
47+
std::chrono::steady_clock::time_point time_of_arrival;
4848
};
4949

5050
/// \brief Rx state variables

0 commit comments

Comments
 (0)