diff --git a/srsue/hdr/phy/phy_metrics.h b/srsue/hdr/phy/phy_metrics.h index 0ca6341fe..9731769aa 100644 --- a/srsue/hdr/phy/phy_metrics.h +++ b/srsue/hdr/phy/phy_metrics.h @@ -26,6 +26,11 @@ namespace srsue { +struct info_metrics_t { + uint32_t pci; + uint32_t dl_earfcn; +}; + struct sync_metrics_t { float ta_us; @@ -55,6 +60,7 @@ struct ul_metrics_t struct phy_metrics_t { + info_metrics_t info[SRSLTE_MAX_CARRIERS]; sync_metrics_t sync[SRSLTE_MAX_CARRIERS]; dl_metrics_t dl[SRSLTE_MAX_CARRIERS]; ul_metrics_t ul[SRSLTE_MAX_CARRIERS]; diff --git a/srsue/src/metrics_stdout.cc b/srsue/src/metrics_stdout.cc index 83affebb8..799567fe9 100644 --- a/srsue/src/metrics_stdout.cc +++ b/srsue/src/metrics_stdout.cc @@ -41,11 +41,9 @@ char const * const prefixes[2][9] = { "", "k", "M", "G", "T", "P", "E", "Z", "Y", }, }; -metrics_stdout::metrics_stdout() - :do_print(false) - ,n_reports(10) - ,ue(NULL) +metrics_stdout::metrics_stdout() : do_print(false), n_reports(10), ue(nullptr) { + // Do nothing } void metrics_stdout::set_ue_handle(ue_metrics_interface *ue_) @@ -60,7 +58,7 @@ void metrics_stdout::toggle_print(bool b) void metrics_stdout::set_metrics(ue_metrics_t &metrics, const uint32_t period_usec) { - if (ue == NULL) { + if (ue == nullptr) { return; } @@ -82,11 +80,12 @@ void metrics_stdout::set_metrics(ue_metrics_t &metrics, const uint32_t period_us { n_reports = 0; cout << endl; - cout << "----Signal--------------DL-------------------------------------UL----------------------" << endl; - cout << "cc rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl; + cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl; + cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl; } for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) { - cout << " " << r; + cout << std::setw(2) << r; + cout << std::setw(4) << metrics.phy.info[r].pci << std::setw(0); cout << float_to_string(metrics.phy.dl[r].rsrp, 2); cout << float_to_string(metrics.phy.dl[r].pathloss, 2); cout << float_to_eng_string(metrics.phy.sync[r].cfo, 2); diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 31a9fd0f1..eef86868f 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -235,6 +235,17 @@ void phy::stop() void phy::get_metrics(phy_metrics_t* m) { + uint32_t dl_earfcn = 0; + srslte_cell_t cell = {}; + get_current_cell(&cell, &dl_earfcn); + m->info[0].pci = cell.id; + m->info[0].dl_earfcn = dl_earfcn; + + for (uint32_t i = 1; i < args.nof_carriers; i++) { + m->info[i].dl_earfcn = common.scell_cfg[i].earfcn; + m->info[i].pci = common.scell_cfg[i].pci; + } + common.get_dl_metrics(m->dl); common.get_ul_metrics(m->ul); common.get_sync_metrics(m->sync);