From 343c30be4a1e2d51381d7e171a6b8486d155b0df Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 7 Aug 2019 14:12:57 +0200 Subject: [PATCH] fix RF metrics/logging in eNB --- srsenb/enb.conf.example | 2 +- srsenb/src/main.cc | 4 ++++ srsenb/src/metrics_stdout.cc | 14 +++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index 262833977..0bac9eced 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -113,7 +113,7 @@ filename = /tmp/enb.pcap # configured. # Format: e.g. phy_hex_limit = 32 # -# Logging layers: phy, mac, rlc, pdcp, rrc, nas, gtpu, usim, all +# Logging layers: rf, phy, mac, rlc, pdcp, rrc, nas, gtpu, usim, all # Logging levels: debug, info, warning, error, none # # filename: File path to use for log output. Can be set to stdout diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index e4b9b40e8..cdb0a7c17 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -102,6 +102,7 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { ("gui.enable", bpo::value(&args->gui.enable)->default_value(false), "Enable GUI plots") + ("log.rf_level", bpo::value(&args->rf.log_level), "RF log level") ("log.phy_level", bpo::value(&args->phy.log.phy_level), "PHY log level") ("log.phy_hex_limit", bpo::value(&args->phy.log.phy_hex_limit), "PHY log hex dump limit") ("log.phy_lib_level", bpo::value(&args->phy.log.phy_lib_level)->default_value("none"), "PHY lib log level") @@ -275,6 +276,9 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { // Apply all_level to any unset layers if (vm.count("log.all_level")) { + if (!vm.count("log.rf_level")) { + args->rf.log_level = args->log.all_level; + } if(!vm.count("log.phy_level")) { args->phy.log.phy_level = args->log.all_level; } diff --git a/srsenb/src/metrics_stdout.cc b/srsenb/src/metrics_stdout.cc index a0d4054e6..a93ec0d31 100644 --- a/srsenb/src/metrics_stdout.cc +++ b/srsenb/src/metrics_stdout.cc @@ -62,7 +62,15 @@ 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 || metrics.stack.rrc.n_ues == 0) { + if (!do_print || enb == nullptr) { + return; + } + + 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); + } + + if (metrics.stack.rrc.n_ues == 0) { return; } @@ -130,10 +138,6 @@ void metrics_stdout::set_metrics(enb_metrics_t &metrics, const uint32_t period_u cout << endl; } - 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); - } - cout.flags(f); // For avoiding Coverity defect: Not restoring ostream format }