From 3573644624d03e2ac42a6affd48ed06c41ef427c Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 28 Dec 2020 16:01:03 +0100 Subject: [PATCH] srsue: fix stdout metrics print when scells aren't configured yet during MAC reset, scells are reset to and their PCI is set to UINT32_MAX which results in malformatted stdout prints, see below: Random Access Transmission: seq=16, ra-rnti=0x2 Random Access Transmission: seq=14, ra-rnti=0x2 0 4 -24 24 -1.1u 1.0 140 0.50 0.0 0% 0.0 0.0 0.0 0.0 67% 14294967295 0.0 0.0 -1.1u 0.0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0% 24294967295 0.0 0.0 -1.1u 0.0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0% 34294967295 0.0 0.0 -1.1u 0.0 0.0 0.0 0.0 0% 0.0 0.0 0.0 0.0 0% this patch checks the configured PCI value against UINT32_MAX and prints "n/a" in case the scells aren't set yet. --- srsue/src/metrics_stdout.cc | 6 +++++- srsue/test/metrics_test.cc | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/srsue/src/metrics_stdout.cc b/srsue/src/metrics_stdout.cc index d64f3e2e2..86a14afb7 100644 --- a/srsue/src/metrics_stdout.cc +++ b/srsue/src/metrics_stdout.cc @@ -115,7 +115,11 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) { cout << std::setw(2) << r; - cout << std::setw(4) << metrics.phy.info[r].pci << std::setw(0); + if (metrics.phy.info[r].pci != UINT32_MAX) { + cout << std::setw(4) << metrics.phy.info[r].pci << std::setw(0); + } else { + cout << " n/a"; + } cout << float_to_string(metrics.phy.ch[r].rsrp, 2); cout << float_to_string(metrics.phy.ch[r].pathloss, 2); cout << float_to_eng_string(metrics.phy.sync[r].cfo, 2); diff --git a/srsue/test/metrics_test.cc b/srsue/test/metrics_test.cc index a53a7c744..4a951ad3d 100644 --- a/srsue/test/metrics_test.cc +++ b/srsue/test/metrics_test.cc @@ -45,6 +45,7 @@ public: m->stack.mac[0].rx_brate = 200; m->stack.mac[0].nof_tti = 1; + m->phy.info[1].pci = UINT32_MAX; m->stack.mac[1].rx_pkts = 100; m->stack.mac[1].rx_errors = 100; m->stack.mac[1].rx_brate = 150;