metrics_stdout: print new table header if neighbour cells change

this fixes an issue where the stdout metrics isn't readable if the only
neighbour cell gets removed during the 10s where no table header is printed.

--------Signal--------------Neighbor----DL-------------------------------------UL----------------------
cc pci  rsrp    pl    cfo  pci  rsrp  mcs   snr turbo  brate   bler   ta_us  mcs   buff  brate   bler
 0   2   -66    61  -3.3k   1   -76    11    18   1.1   8.4M     3%   0.0    21    262   167k     0%
 0   2   -65    60  -3.3k   1   -76    12    19   1.1   9.6M     2%   0.0    22    476   214k     0%
 0   2   -65    60  -3.3k   1   -76    16    22   1.3    13M     3%   0.0    23   1.1k   734k     0%
 0   2   -64    59  -3.3k   1   -76    17    23   1.3    15M     2%   0.0    23    602   424k     0%
 0   2   -63    58  -3.3k   1   -77    20    25   1.4    19M     3%   0.0    23    501   304k     0%
 0   2   -62    57  -3.3k   1   -77    22    27   1.8    20M    10%   0.0    22    417   418k     0%
 0   2   -61    56  -3.3k   1   -77    24    28   1.8    25M     9%   0.0    23    396   439k     0%
 0   2   -61    56  -3.3k   1   -77    26    29   1.5    23M    22%   0.0    23    841   407k     0%
 0   2   -60    55  -3.3k   1   -77    27    31   1.3    27M    11%   0.0    23    890   1.1M     0%
 0   2   -59    54  -3.3k   1   -77    27    32  1.00    30M     3%   0.0    23    583   524k     0%
 0   2   -59    54  -3.3k   1   -77    27    32  0.92    32M     1%   0.0    23   1.1k   503k     0%

--------Signal--------------DL-------------------------------------UL----------------------
cc pci  rsrp    pl    cfo   mcs   snr turbo  brate   bler   ta_us  mcs   buff  brate   bler
 0   2   -59    54  -3.3k    27    31   1.1    30M     4%   0.0    23   1.2k   529k     0%
 0   2   -60    55  -3.3k    27    30   1.4    25M    18%   0.0    23    540   442k     0%
 0   2   -61    56  -3.3k    26    29   1.6    23M    21%   0.0    23    536   429k     0%
 0   2   -62    57  -3.3k    24    28   1.8    23M    13%   0.0    23    834   456k     0%
 0   2   -62    57  -3.3k   1   -78    21    26   1.6    20M     7%   0.0    23    723   425k     0%
 0   2   -63    58  -3.3k   1   -76    17    22   1.1    15M     3%   0.0    23    470   267k     0%
 0   2   -64    59  -3.3k   1   -77    17    22   1.3    15M     3%   0.0    23    167   280k     0%
 0   2   -65    60  -3.3k   1   -76    14    21   1.3    11M     2%   0.0    22     57   223k     0%
 0   2   -65    60  -3.3k   1   -76    12    19   1.2   9.0M     3%   0.0    21    135   182k     0%
 0   2   -66    61  -3.4k   1   -70   9.3    17   1.0   6.9M     2%   0.0    21    246   126k     0%
 0   2   -67    62  -3.3k   1   -75   8.2    16   1.1   4.9M     3%   0.0    20    0.0   122k     0%
master
Andre Puschmann 4 years ago
parent 2f0125ef4e
commit ddbf4e1645

@ -39,7 +39,7 @@ namespace srsue {
class metrics_stdout : public srslte::metrics_listener<ue_metrics_t> class metrics_stdout : public srslte::metrics_listener<ue_metrics_t>
{ {
public: public:
metrics_stdout(); metrics_stdout(){};
void toggle_print(bool b); void toggle_print(bool b);
void set_metrics(const ue_metrics_t& m, const uint32_t period_usec); void set_metrics(const ue_metrics_t& m, const uint32_t period_usec);
@ -49,10 +49,12 @@ public:
private: private:
std::string float_to_string(float f, int digits); std::string float_to_string(float f, int digits);
std::string float_to_eng_string(float f, int digits); std::string float_to_eng_string(float f, int digits);
void print_table(const bool display_neighbours);
bool do_print; bool do_print = false;
uint8_t n_reports; bool table_has_neighbours = false; ///< state of last table head
ue_metrics_interface* ue; uint8_t n_reports = 10;
ue_metrics_interface* ue = nullptr;
}; };
} // namespace srsue } // namespace srsue

@ -60,11 +60,6 @@ char const* const prefixes[2][9] = {
}, },
}; };
metrics_stdout::metrics_stdout() : do_print(false), n_reports(10), ue(nullptr)
{
// Do nothing
}
void metrics_stdout::set_ue_handle(ue_metrics_interface* ue_) void metrics_stdout::set_ue_handle(ue_metrics_interface* ue_)
{ {
ue = ue_; ue = ue_;
@ -75,6 +70,20 @@ void metrics_stdout::toggle_print(bool b)
do_print = b; do_print = b;
} }
void metrics_stdout::print_table(const bool display_neighbours)
{
if (display_neighbours) {
cout << "--------Signal-------------Neighbour--DL-------------------------------------UL----------------------"
<< endl;
cout << "cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler"
<< endl;
} else {
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
}
table_has_neighbours = display_neighbours;
}
void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t period_usec) void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t period_usec)
{ {
if (ue == nullptr) { if (ue == nullptr) {
@ -102,19 +111,18 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
display_neighbours = metrics.stack.rrc.neighbour_cells.size() > 0; display_neighbours = metrics.stack.rrc.neighbour_cells.size() > 0;
} }
// print table header every 10 reports
if (++n_reports > 10) { if (++n_reports > 10) {
n_reports = 0; n_reports = 0;
cout << endl; cout << endl;
if (display_neighbours) { print_table(display_neighbours);
cout << "--------Signal--------------Neighbor----DL-------------------------------------UL----------------------"
<< endl;
cout << "cc pci rsrp pl cfo pci rsrp mcs snr turbo brate bler ta_us mcs buff brate bler"
<< endl;
} else {
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
} }
// also print table header if neighbours are added/removed in between
if (display_neighbours != table_has_neighbours) {
print_table(display_neighbours);
} }
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) { for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
cout << std::setw(2) << r; cout << std::setw(2) << r;
cout << std::setw(4) << metrics.phy.info[r].pci << std::setw(0); cout << std::setw(4) << metrics.phy.info[r].pci << std::setw(0);

Loading…
Cancel
Save