|
|
|
@ -70,16 +70,28 @@ void metrics_stdout::toggle_print(bool b)
|
|
|
|
|
do_print = b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void metrics_stdout::print_table(const bool display_neighbours)
|
|
|
|
|
void metrics_stdout::print_table(const bool display_neighbours, const bool is_nr)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
if (is_nr) {
|
|
|
|
|
if (display_neighbours) {
|
|
|
|
|
fmt::print(
|
|
|
|
|
"---------Signal----------|-Neighbour-|-----------------DL-----------------|-----------UL-----------\n");
|
|
|
|
|
fmt::print(
|
|
|
|
|
"rat pci rsrp pl cfo | pci rsrp | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print("---------Signal----------|-----------------DL-----------------|-----------UL-----------\n");
|
|
|
|
|
fmt::print("rat pci rsrp pl cfo | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
cout << "--------Signal--------------DL-------------------------------------UL----------------------" << endl;
|
|
|
|
|
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler" << endl;
|
|
|
|
|
if (display_neighbours) {
|
|
|
|
|
fmt::print(
|
|
|
|
|
"---------Signal----------|-Neighbour-|-----------------DL-----------------|-----------UL-----------\n");
|
|
|
|
|
fmt::print(
|
|
|
|
|
" cc pci rsrp pl cfo | pci rsrp | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print("---------Signal----------|-----------------DL-----------------|-----------UL-----------\n");
|
|
|
|
|
fmt::print(" cc pci rsrp pl cfo | mcs snr iter brate bler ta_us | mcs buff brate bler\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
table_has_neighbours = display_neighbours;
|
|
|
|
|
n_reports = 0;
|
|
|
|
@ -89,56 +101,71 @@ void metrics_stdout::set_metrics_helper(const phy_metrics_t& phy,
|
|
|
|
|
const mac_metrics_t mac[SRSRAN_MAX_CARRIERS],
|
|
|
|
|
const rrc_metrics_t& rrc,
|
|
|
|
|
bool display_neighbours,
|
|
|
|
|
const uint32_t r)
|
|
|
|
|
const uint32_t r,
|
|
|
|
|
bool is_carrier_nr,
|
|
|
|
|
bool print_carrier_num)
|
|
|
|
|
{
|
|
|
|
|
if (print_carrier_num) {
|
|
|
|
|
fmt::print("{:>3}", r);
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print("{:>3.3}", (is_carrier_nr) ? "nr" : "lte");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (phy.info[r].pci != UINT32_MAX) {
|
|
|
|
|
cout << std::setw(4) << phy.info[r].pci << std::setw(0);
|
|
|
|
|
fmt::print(" {:>3}", phy.info[r].pci);
|
|
|
|
|
} else {
|
|
|
|
|
cout << " n/a";
|
|
|
|
|
fmt::print(" {:>3.3}", "n/a");
|
|
|
|
|
}
|
|
|
|
|
cout << float_to_string(phy.ch[r].rsrp, 2);
|
|
|
|
|
cout << float_to_string(phy.ch[r].pathloss, 2);
|
|
|
|
|
cout << float_to_eng_string(phy.sync[r].cfo, 2);
|
|
|
|
|
|
|
|
|
|
fmt::print(" {:>4}", int(phy.ch[r].rsrp));
|
|
|
|
|
fmt::print(" {:>2}", int(phy.ch[r].pathloss));
|
|
|
|
|
fmt::print(" {:>5.5}", float_to_eng_string(phy.sync[r].cfo, 2));
|
|
|
|
|
|
|
|
|
|
// Find strongest neighbour for this EARFCN (cells are ordered)
|
|
|
|
|
if (display_neighbours) {
|
|
|
|
|
bool has_neighbour = false;
|
|
|
|
|
fmt::print(" |");
|
|
|
|
|
for (auto& c : rrc.neighbour_cells) {
|
|
|
|
|
if (c.earfcn == phy.info[r].dl_earfcn && c.pci != phy.info[r].pci) {
|
|
|
|
|
cout << std::setw(4) << c.pci << std::setw(0);
|
|
|
|
|
cout << float_to_string(c.rsrp, 2);
|
|
|
|
|
fmt::print(" {:>3}", c.pci);
|
|
|
|
|
fmt::print(" {:>4}", int(c.rsrp));
|
|
|
|
|
has_neighbour = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!has_neighbour) {
|
|
|
|
|
cout << " n/a";
|
|
|
|
|
cout << " n/a";
|
|
|
|
|
fmt::print(" {:>3.3}", "n/a");
|
|
|
|
|
fmt::print(" {:>4.4}", "n/a");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cout << float_to_string(phy.dl[r].mcs, 2);
|
|
|
|
|
cout << float_to_string(phy.ch[r].sinr, 2);
|
|
|
|
|
cout << float_to_string(phy.dl[r].fec_iters, 2);
|
|
|
|
|
fmt::print(" |");
|
|
|
|
|
|
|
|
|
|
fmt::print(" {:>2}", int(phy.dl[r].mcs));
|
|
|
|
|
fmt::print(" {:>3}", int(phy.ch[r].sinr));
|
|
|
|
|
fmt::print(" {:>4.1f}", phy.dl[r].fec_iters);
|
|
|
|
|
|
|
|
|
|
cout << float_to_eng_string((float)mac[r].rx_brate / (mac[r].nof_tti * 1e-3), 2);
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].rx_brate / (mac[r].nof_tti * 1e-3), 2));
|
|
|
|
|
if (mac[r].rx_pkts > 0) {
|
|
|
|
|
cout << float_to_string((float)100 * mac[r].rx_errors / mac[r].rx_pkts, 1) << "%";
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * mac[r].rx_errors / mac[r].rx_pkts));
|
|
|
|
|
} else {
|
|
|
|
|
cout << float_to_string(0, 1) << "%";
|
|
|
|
|
fmt::print(" {:>3}%", 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cout << float_to_string(phy.sync[r].ta_us, 2);
|
|
|
|
|
fmt::print(" {:>4.1f}", phy.sync[r].ta_us);
|
|
|
|
|
|
|
|
|
|
fmt::print(" |");
|
|
|
|
|
|
|
|
|
|
fmt::print(" {:>2}", int(phy.ul[r].mcs));
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].ul_buffer, 2));
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string((float)mac[r].tx_brate / (mac[r].nof_tti * 1e-3), 2));
|
|
|
|
|
|
|
|
|
|
cout << float_to_string(phy.ul[r].mcs, 2);
|
|
|
|
|
cout << float_to_eng_string((float)mac[r].ul_buffer, 2);
|
|
|
|
|
cout << float_to_eng_string((float)mac[r].tx_brate / (mac[r].nof_tti * 1e-3), 2);
|
|
|
|
|
if (mac[r].tx_pkts > 0) {
|
|
|
|
|
cout << float_to_string((float)100 * mac[r].tx_errors / mac[r].tx_pkts, 1) << "%";
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * mac[r].tx_errors / mac[r].tx_pkts));
|
|
|
|
|
} else {
|
|
|
|
|
cout << float_to_string(0, 1) << "%";
|
|
|
|
|
fmt::print(" {:>3}%", 0);
|
|
|
|
|
}
|
|
|
|
|
cout << endl;
|
|
|
|
|
fmt::print("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t period_usec)
|
|
|
|
@ -149,7 +176,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
|
|
|
|
|
|
|
|
|
|
// always print 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);
|
|
|
|
|
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!do_print) {
|
|
|
|
@ -157,7 +184,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (metrics.stack.rrc.state != RRC_STATE_CONNECTED) {
|
|
|
|
|
cout << "--- disconnected ---" << endl;
|
|
|
|
|
fmt::print("--- disconnected ---\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -168,29 +195,29 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
|
|
|
|
|
display_neighbours |= metrics.stack.rrc.neighbour_cells.size() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool is_nr = metrics.phy_nr.nof_active_cc > 0;
|
|
|
|
|
|
|
|
|
|
// print table header every 10 reports
|
|
|
|
|
if (++n_reports > 10) {
|
|
|
|
|
print_table(display_neighbours);
|
|
|
|
|
print_table(display_neighbours, is_nr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// also print table header if neighbours are added/removed in between
|
|
|
|
|
if (display_neighbours != table_has_neighbours) {
|
|
|
|
|
print_table(display_neighbours);
|
|
|
|
|
print_table(display_neighbours, is_nr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
|
|
|
|
|
cout << std::setw(2) << r;
|
|
|
|
|
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r);
|
|
|
|
|
set_metrics_helper(metrics.phy, metrics.stack.mac, metrics.stack.rrc, display_neighbours, r, false, !is_nr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint32_t r = 0; r < metrics.phy_nr.nof_active_cc; r++) {
|
|
|
|
|
// Assumption LTE is followed by the NR carriers.
|
|
|
|
|
cout << std::setw(2) << metrics.phy_nr.nof_active_cc + r;
|
|
|
|
|
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r);
|
|
|
|
|
set_metrics_helper(metrics.phy_nr, metrics.stack.mac_nr, metrics.stack.rrc, display_neighbours, r, true, !is_nr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -199,7 +226,7 @@ std::string metrics_stdout::float_to_string(float f, int digits)
|
|
|
|
|
std::ostringstream os;
|
|
|
|
|
const int precision =
|
|
|
|
|
SRSRAN_MIN((int)((f == 0.0f || f == 100.0f) ? digits - 1 : digits - log10f(fabsf(f)) - 2 * FLT_EPSILON), 3);
|
|
|
|
|
os << std::setw(6) << std::fixed << std::setprecision(precision) << f;
|
|
|
|
|
os << std::fixed << std::setprecision(precision) << f;
|
|
|
|
|
return os.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -222,7 +249,7 @@ std::string metrics_stdout::float_to_eng_string(float f, int digits)
|
|
|
|
|
if (degree != 0) {
|
|
|
|
|
return float_to_string(scaled, digits) + factor;
|
|
|
|
|
} else {
|
|
|
|
|
return " " + float_to_string(scaled, digits) + factor;
|
|
|
|
|
return float_to_string(scaled, digits) + factor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|