rlc: pass TTI to get_metrics to calculate "real" LTE rx/tx rate

when retrieving the RLC metrics, the number of TTIs since the last
call are passed. This allows to calculate the actual rate
based on the LTE timing rather than only the system timing.
master
Andre Puschmann 4 years ago
parent cff9f03a11
commit c0883291f6

@ -44,7 +44,7 @@ public:
bsr_callback_t bsr_callback_); bsr_callback_t bsr_callback_);
void stop(); void stop();
void get_metrics(rlc_metrics_t& m); void get_metrics(rlc_metrics_t& m, const uint32_t nof_tti);
// PDCP interface // PDCP interface
void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu); void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu);

@ -94,7 +94,7 @@ void rlc::stop()
} }
} }
void rlc::get_metrics(rlc_metrics_t& m) void rlc::get_metrics(rlc_metrics_t& m, const uint32_t nof_tti)
{ {
gettimeofday(&metrics_time[2], NULL); gettimeofday(&metrics_time[2], NULL);
get_time_interval(metrics_time); get_time_interval(metrics_time);
@ -102,17 +102,28 @@ void rlc::get_metrics(rlc_metrics_t& m)
for (rlc_map_t::iterator it = rlc_array.begin(); it != rlc_array.end(); ++it) { for (rlc_map_t::iterator it = rlc_array.begin(); it != rlc_array.end(); ++it) {
rlc_bearer_metrics_t metrics = it->second->get_metrics(); rlc_bearer_metrics_t metrics = it->second->get_metrics();
rlc_log->info("LCID=%d, RX throughput: %4.6f Mbps. TX throughput: %4.6f Mbps.\n",
// Rx/Tx rate based on real time
double rx_rate_mbps_real_time = (metrics.num_rx_pdu_bytes * 8 / (double)1e6) / secs;
double tx_rate_mbps_real_time = (metrics.num_tx_pdu_bytes * 8 / (double)1e6) / secs;
// Rx/Tx rate based on number of TTIs
double rx_rate_mbps = (metrics.num_rx_pdu_bytes * 8 / (double)1e6) / (nof_tti / 1000.0);
double tx_rate_mbps = (metrics.num_tx_pdu_bytes * 8 / (double)1e6) / (nof_tti / 1000.0);
rlc_log->info("lcid=%d, rx_rate_mbps=%4.2f (real=%4.2f), tx_rate_mbps=%4.2f (real=%4.2f)\n",
it->first, it->first,
(metrics.num_rx_pdu_bytes * 8 / static_cast<double>(1e6)) / secs, rx_rate_mbps,
(metrics.num_tx_pdu_bytes * 8 / static_cast<double>(1e6)) / secs); rx_rate_mbps_real_time,
tx_rate_mbps,
tx_rate_mbps_real_time);
m.bearer[it->first] = metrics; m.bearer[it->first] = metrics;
} }
// Add multicast metrics // Add multicast metrics
for (rlc_map_t::iterator it = rlc_array_mrb.begin(); it != rlc_array_mrb.end(); ++it) { for (rlc_map_t::iterator it = rlc_array_mrb.begin(); it != rlc_array_mrb.end(); ++it) {
rlc_bearer_metrics_t metrics = it->second->get_metrics(); rlc_bearer_metrics_t metrics = it->second->get_metrics();
rlc_log->info("MCH_LCID=%d, RX throughput: %4.6f Mbps\n", rlc_log->info("MCH_LCID=%d, rx_rate_mbps=%4.2f\n",
it->first, it->first,
(metrics.num_rx_pdu_bytes * 8 / static_cast<double>(1e6)) / secs); (metrics.num_rx_pdu_bytes * 8 / static_cast<double>(1e6)) / secs);
m.bearer[it->first] = metrics; m.bearer[it->first] = metrics;

@ -517,7 +517,7 @@ void stress_test(stress_test_args_t args)
} }
rlc_metrics_t metrics = {}; rlc_metrics_t metrics = {};
rlc1.get_metrics(metrics); rlc1.get_metrics(metrics, 1);
printf("RLC1 received %d SDUs in %ds (%.2f/s), Tx=%" PRIu64 " B, Rx=%" PRIu64 " B\n", printf("RLC1 received %d SDUs in %ds (%.2f/s), Tx=%" PRIu64 " B, Rx=%" PRIu64 " B\n",
tester1.get_nof_rx_pdus(), tester1.get_nof_rx_pdus(),
@ -527,7 +527,7 @@ void stress_test(stress_test_args_t args)
metrics.bearer[lcid].num_rx_pdu_bytes); metrics.bearer[lcid].num_rx_pdu_bytes);
rlc_bearer_metrics_print(metrics.bearer[lcid]); rlc_bearer_metrics_print(metrics.bearer[lcid]);
rlc2.get_metrics(metrics); rlc2.get_metrics(metrics, 1);
printf("RLC2 received %d SDUs in %ds (%.2f/s), Tx=%" PRIu64 " B, Rx=%" PRIu64 " B\n", printf("RLC2 received %d SDUs in %ds (%.2f/s), Tx=%" PRIu64 " B, Rx=%" PRIu64 " B\n",
tester2.get_nof_rx_pdus(), tester2.get_nof_rx_pdus(),
args.test_duration_sec, args.test_duration_sec,

@ -209,7 +209,7 @@ bool ue_stack_lte::get_metrics(stack_metrics_t* metrics)
ue_task_queue.try_push([this]() { ue_task_queue.try_push([this]() {
stack_metrics_t metrics{}; stack_metrics_t metrics{};
mac.get_metrics(metrics.mac); mac.get_metrics(metrics.mac);
rlc.get_metrics(metrics.rlc); rlc.get_metrics(metrics.rlc, metrics.mac[0].nof_tti);
nas.get_metrics(&metrics.nas); nas.get_metrics(&metrics.nas);
rrc.get_metrics(metrics.rrc); rrc.get_metrics(metrics.rrc);
pending_stack_metrics.push(metrics); pending_stack_metrics.push(metrics);

@ -132,7 +132,7 @@ bool ue_stack_nr::switch_off()
bool ue_stack_nr::get_metrics(stack_metrics_t* metrics) bool ue_stack_nr::get_metrics(stack_metrics_t* metrics)
{ {
// mac.get_metrics(metrics->mac); // mac.get_metrics(metrics->mac);
rlc->get_metrics(metrics->rlc); rlc->get_metrics(metrics->rlc, metrics->mac[0].nof_tti);
// rrc.get_metrics(metrics->rrc); // rrc.get_metrics(metrics->rrc);
return true; return true;
} }

Loading…
Cancel
Save