From 1f3b3d5ef28543358dd1c78c96dcda322d771932 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 7 Jul 2021 18:00:27 +0200 Subject: [PATCH] Show PDSCH and PUSCH metrics if any transmitted --- test/phy/nr_phy_test.cc | 65 ++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/test/phy/nr_phy_test.cc b/test/phy/nr_phy_test.cc index 78cfe3c46..2505a2645 100644 --- a/test/phy/nr_phy_test.cc +++ b/test/phy/nr_phy_test.cc @@ -155,38 +155,43 @@ int main(int argc, char** argv) // Retrieve MAC metrics srsenb::mac_ue_metrics_t mac_metrics = tb.get_gnb_metrics(); - // Print metrics - float pdsch_bler = 0.0f; - if (mac_metrics.tx_pkts != 0) { - pdsch_bler = (float)mac_metrics.tx_errors / (float)mac_metrics.tx_pkts; - } - float pusch_bler = 0.0f; - if (mac_metrics.rx_pkts != 0) { - pusch_bler = (float)mac_metrics.rx_errors / (float)mac_metrics.rx_pkts; - } - float pdsch_shed_rate = 0.0f; - if (mac_metrics.tx_pkts != 0) { - pdsch_shed_rate = (float)mac_metrics.tx_brate / (float)mac_metrics.tx_pkts / 1000.0f; - } - float pusch_shed_rate = 0.0f; - if (mac_metrics.rx_pkts != 0) { - pusch_shed_rate = (float)mac_metrics.rx_brate / (float)mac_metrics.rx_pkts / 1000.0f; + // Print PDSCH metrics if scheduled + if (mac_metrics.tx_pkts > 0) { + float pdsch_bler = 0.0f; + pdsch_bler = (float)mac_metrics.tx_errors / (float)mac_metrics.tx_pkts; + + float pdsch_shed_rate = 0.0f; + pdsch_shed_rate = (float)mac_metrics.tx_brate / (float)mac_metrics.tx_pkts / 1000.0f; + + srsran::console("PDSCH:\n"); + srsran::console(" Count: %d\n", mac_metrics.tx_pkts); + srsran::console(" BLER: %f\n", pdsch_bler); + srsran::console(" Sched Rate: %f Mbps\n", pdsch_shed_rate); + srsran::console(" Net Rate: %f Mbps\n", (1.0f - pdsch_bler) * pdsch_shed_rate); + srsran::console(" Retx Rate: %f Mbps\n", pdsch_bler * pdsch_shed_rate); + srsran::console("\n"); } - srsran::console("PDSCH:\n"); - srsran::console(" Count: %d\n", mac_metrics.tx_pkts); - srsran::console(" BLER: %f\n", pdsch_bler); - srsran::console(" Sched Rate: %f Mbps\n", pdsch_shed_rate); - srsran::console(" Net Rate: %f Mbps\n", (1.0f - pdsch_bler) * pdsch_shed_rate); - srsran::console(" Retx Rate: %f Mbps\n", pdsch_bler * pdsch_shed_rate); - - srsran::console("\n"); - srsran::console("PUSCH:\n"); - srsran::console(" Count: %d\n", mac_metrics.rx_pkts); - srsran::console(" BLER: %f\n", pusch_bler); - srsran::console(" Sched Rate: %f Mbps\n", pusch_shed_rate); - srsran::console(" Net Rate: %f Mbps\n", (1.0f - pusch_bler) * pusch_shed_rate); - srsran::console(" Retx Rate: %f Mbps\n", pusch_bler * pusch_shed_rate); + // Print PUSCH metrics if scheduled + if (mac_metrics.rx_pkts > 0) { + float pusch_bler = 0.0f; + if (mac_metrics.rx_pkts != 0) { + pusch_bler = (float)mac_metrics.rx_errors / (float)mac_metrics.rx_pkts; + } + + float pusch_shed_rate = 0.0f; + if (mac_metrics.rx_pkts != 0) { + pusch_shed_rate = (float)mac_metrics.rx_brate / (float)mac_metrics.rx_pkts / 1000.0f; + } + + srsran::console("PUSCH:\n"); + srsran::console(" Count: %d\n", mac_metrics.rx_pkts); + srsran::console(" BLER: %f\n", pusch_bler); + srsran::console(" Sched Rate: %f Mbps\n", pusch_shed_rate); + srsran::console(" Net Rate: %f Mbps\n", (1.0f - pusch_bler) * pusch_shed_rate); + srsran::console(" Retx Rate: %f Mbps\n", pusch_bler * pusch_shed_rate); + srsran::console("\n"); + } // Assert metrics TESTASSERT(mac_metrics.tx_errors == 0);