From c60f7e90139bdbe899e2451e83767d86f4a10251 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 3 Dec 2018 09:46:44 +0100 Subject: [PATCH] remove "disconnected" from enb console trace --- srsenb/src/metrics_stdout.cc | 117 ++++++++++++++++------------------- 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/srsenb/src/metrics_stdout.cc b/srsenb/src/metrics_stdout.cc index 786ed1f85..e2c8bb0c0 100644 --- a/srsenb/src/metrics_stdout.cc +++ b/srsenb/src/metrics_stdout.cc @@ -67,80 +67,73 @@ void metrics_stdout::toggle_print(bool b) void metrics_stdout::set_metrics(enb_metrics_t &metrics, const uint32_t period_usec) { - if (!do_print || enb == NULL) { + if (!do_print || enb == NULL || metrics.rrc.n_ues == 0) { return; } std::ios::fmtflags f(cout.flags()); // For avoiding Coverity defect: Not restoring ostream format - if (metrics.rrc.n_ues == 0) { - cout << "--- disconnected ---" << endl; - return; - } - - if(++n_reports > 10) - { + if (++n_reports > 10) { n_reports = 0; cout << endl; cout << "------DL------------------------------UL----------------------------------" << endl; cout << "rnti cqi ri mcs brate bler snr phr mcs brate bler bsr" << endl; } - if (metrics.rrc.n_ues > 0) { - - for (int i=0;i metrics.mac[i].tx_pkts) { - printf("tx caution errors %d > %d\n", metrics.mac[i].tx_errors, metrics.mac[i].tx_pkts); - } - if (metrics.mac[i].rx_errors > metrics.mac[i].rx_pkts) { - printf("rx caution errors %d > %d\n", metrics.mac[i].rx_errors, metrics.mac[i].rx_pkts); - } - - cout << std::hex << metrics.mac[i].rnti << " "; - cout << float_to_string(SRSLTE_MAX(0.1,metrics.mac[i].dl_cqi), 2); - cout << float_to_string(metrics.mac[i].dl_ri, 1); - if(not isnan(metrics.phy[i].dl.mcs)) { - cout << float_to_string(SRSLTE_MAX(0.1,metrics.phy[i].dl.mcs), 2); - } else { - cout << float_to_string(0,2); - } - if (metrics.mac[i].tx_brate > 0) { - cout << float_to_eng_string(SRSLTE_MAX(0.1,(float) metrics.mac[i].tx_brate/period_usec*1e6), 2); - } else { - cout << float_to_string(0, 2) << ""; - } - if (metrics.mac[i].tx_pkts > 0 && metrics.mac[i].tx_errors) { - cout << float_to_string(SRSLTE_MAX(0.1,(float) 100*metrics.mac[i].tx_errors/metrics.mac[i].tx_pkts), 1) << "%"; - } else { - cout << float_to_string(0, 1) << "%"; - } - if(not isnan(metrics.phy[i].ul.sinr)) { - cout << float_to_string(SRSLTE_MAX(0.1,metrics.phy[i].ul.sinr), 2); - } else { - cout << float_to_string(0,2); - } - cout << float_to_string(metrics.mac[i].phr, 2); - if(not isnan(metrics.phy[i].ul.mcs)) { - cout << float_to_string(SRSLTE_MAX(0.1,metrics.phy[i].ul.mcs), 2); - } else { - cout << float_to_string(0,2); - } - if (metrics.mac[i].rx_brate > 0) { - cout << float_to_eng_string(SRSLTE_MAX(0.1,(float) metrics.mac[i].rx_brate/period_usec*1e6), 2); - } else { - cout << float_to_string(0, 2) << ""; - } - if (metrics.mac[i].rx_pkts > 0 && metrics.mac[i].rx_errors > 0) { - cout << float_to_string(SRSLTE_MAX(0.1,(float) 100*metrics.mac[i].rx_errors/metrics.mac[i].rx_pkts), 1) << "%"; - } else { - cout << float_to_string(0, 1) << "%"; - } - cout << float_to_eng_string(metrics.mac[i].ul_buffer, 2); - cout << endl; + + for (int i = 0; i < metrics.rrc.n_ues; i++) { + if (metrics.mac[i].tx_errors > metrics.mac[i].tx_pkts) { + printf("tx caution errors %d > %d\n", metrics.mac[i].tx_errors, metrics.mac[i].tx_pkts); } - } else { - cout << "--- No users ---" << endl; + if (metrics.mac[i].rx_errors > metrics.mac[i].rx_pkts) { + printf("rx caution errors %d > %d\n", metrics.mac[i].rx_errors, metrics.mac[i].rx_pkts); + } + + cout << std::hex << metrics.mac[i].rnti << " "; + cout << float_to_string(SRSLTE_MAX(0.1, metrics.mac[i].dl_cqi), 2); + cout << float_to_string(metrics.mac[i].dl_ri, 1); + if (not isnan(metrics.phy[i].dl.mcs)) { + cout << float_to_string(SRSLTE_MAX(0.1, metrics.phy[i].dl.mcs), 2); + } else { + cout << float_to_string(0, 2); + } + if (metrics.mac[i].tx_brate > 0) { + cout << float_to_eng_string(SRSLTE_MAX(0.1, (float)metrics.mac[i].tx_brate / period_usec * 1e6), 2); + } else { + cout << float_to_string(0, 2) << ""; + } + if (metrics.mac[i].tx_pkts > 0 && metrics.mac[i].tx_errors) { + cout << float_to_string(SRSLTE_MAX(0.1, (float)100 * metrics.mac[i].tx_errors / metrics.mac[i].tx_pkts), 1) + << "%"; + } else { + cout << float_to_string(0, 1) << "%"; + } + if (not isnan(metrics.phy[i].ul.sinr)) { + cout << float_to_string(SRSLTE_MAX(0.1, metrics.phy[i].ul.sinr), 2); + } else { + cout << float_to_string(0, 2); + } + cout << float_to_string(metrics.mac[i].phr, 2); + if (not isnan(metrics.phy[i].ul.mcs)) { + cout << float_to_string(SRSLTE_MAX(0.1, metrics.phy[i].ul.mcs), 2); + } else { + cout << float_to_string(0, 2); + } + if (metrics.mac[i].rx_brate > 0) { + cout << float_to_eng_string(SRSLTE_MAX(0.1, (float)metrics.mac[i].rx_brate / period_usec * 1e6), 2); + } else { + cout << float_to_string(0, 2) << ""; + } + if (metrics.mac[i].rx_pkts > 0 && metrics.mac[i].rx_errors > 0) { + cout << float_to_string(SRSLTE_MAX(0.1, (float)100 * metrics.mac[i].rx_errors / metrics.mac[i].rx_pkts), 1) + << "%"; + } else { + cout << float_to_string(0, 1) << "%"; + } + cout << float_to_eng_string(metrics.mac[i].ul_buffer, 2); + cout << endl; } - if(metrics.rf.rf_error) { + + if (metrics.rf.rf_error) { printf("RF status: O=%d, U=%d, L=%d\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l); }