|
|
|
@ -71,62 +71,43 @@ static bool iszero(float x)
|
|
|
|
|
return fabsf(x) < 2 * DBL_EPSILON;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t period_usec)
|
|
|
|
|
void metrics_stdout::set_metrics_helper(uint32_t num_ue,
|
|
|
|
|
const mac_metrics_t& mac,
|
|
|
|
|
const std::vector<phy_metrics_t>& phy)
|
|
|
|
|
{
|
|
|
|
|
if (!do_print || enb == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (metrics.rf.rf_error) {
|
|
|
|
|
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (metrics.stack.rrc.ues.size() == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (++n_reports > 10) {
|
|
|
|
|
n_reports = 0;
|
|
|
|
|
fmt::print("\n");
|
|
|
|
|
fmt::print("-------------------DL--------------------|-------------------------UL-------------------------\n");
|
|
|
|
|
fmt::print("rnti cqi ri mcs brate ok nok (%) | pusch pucch phr mcs brate ok nok (%) bsr\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < metrics.stack.rrc.ues.size(); i++) {
|
|
|
|
|
for (size_t i = 0; i < num_ue; i++) {
|
|
|
|
|
// make sure we have stats for MAC and PHY layer too
|
|
|
|
|
if (i >= metrics.stack.mac.ues.size() || i >= metrics.phy.size()) {
|
|
|
|
|
if (i >= mac.ues.size() || i >= phy.size()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (metrics.stack.mac.ues[i].tx_errors > metrics.stack.mac.ues[i].tx_pkts) {
|
|
|
|
|
fmt::print("tx caution errors {} > {}\n", metrics.stack.mac.ues[i].tx_errors, metrics.stack.mac.ues[i].tx_pkts);
|
|
|
|
|
if (mac.ues[i].tx_errors > mac.ues[i].tx_pkts) {
|
|
|
|
|
fmt::print("tx caution errors {} > {}\n", mac.ues[i].tx_errors, mac.ues[i].tx_pkts);
|
|
|
|
|
}
|
|
|
|
|
if (metrics.stack.mac.ues[i].rx_errors > metrics.stack.mac.ues[i].rx_pkts) {
|
|
|
|
|
fmt::print("rx caution errors {} > {}\n", metrics.stack.mac.ues[i].rx_errors, metrics.stack.mac.ues[i].rx_pkts);
|
|
|
|
|
if (mac.ues[i].rx_errors > mac.ues[i].rx_pkts) {
|
|
|
|
|
fmt::print("rx caution errors {} > {}\n", mac.ues[i].rx_errors, mac.ues[i].rx_pkts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt::print("{:>4x}", metrics.stack.mac.ues[i].rnti);
|
|
|
|
|
if (not iszero(metrics.stack.mac.ues[i].dl_cqi)) {
|
|
|
|
|
fmt::print(" {:>3}", int(metrics.stack.mac.ues[i].dl_cqi));
|
|
|
|
|
fmt::print("{:>4x}", mac.ues[i].rnti);
|
|
|
|
|
if (not iszero(mac.ues[i].dl_cqi)) {
|
|
|
|
|
fmt::print(" {:>3}", int(mac.ues[i].dl_cqi));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>3.3}", "n/a");
|
|
|
|
|
}
|
|
|
|
|
fmt::print(" {:>1}", int(metrics.stack.mac.ues[i].dl_ri));
|
|
|
|
|
if (not isnan(metrics.phy[i].dl.mcs)) {
|
|
|
|
|
fmt::print(" {:>2}", int(metrics.phy[i].dl.mcs));
|
|
|
|
|
fmt::print(" {:>1}", int(mac.ues[i].dl_ri));
|
|
|
|
|
if (not isnan(phy[i].dl.mcs)) {
|
|
|
|
|
fmt::print(" {:>2}", int(phy[i].dl.mcs));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>2}", 0);
|
|
|
|
|
}
|
|
|
|
|
if (metrics.stack.mac.ues[i].tx_brate > 0) {
|
|
|
|
|
fmt::print(
|
|
|
|
|
" {:>6.6}",
|
|
|
|
|
float_to_eng_string((float)metrics.stack.mac.ues[i].tx_brate / (metrics.stack.mac.ues[i].nof_tti * 1e-3), 1));
|
|
|
|
|
if (mac.ues[i].tx_brate > 0) {
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string((float)mac.ues[i].tx_brate / (mac.ues[i].nof_tti * 1e-3), 1));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>6}", 0);
|
|
|
|
|
}
|
|
|
|
|
fmt::print(" {:>4}", metrics.stack.mac.ues[i].tx_pkts - metrics.stack.mac.ues[i].tx_errors);
|
|
|
|
|
fmt::print(" {:>4}", metrics.stack.mac.ues[i].tx_errors);
|
|
|
|
|
if (metrics.stack.mac.ues[i].tx_pkts > 0 && metrics.stack.mac.ues[i].tx_errors) {
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * metrics.stack.mac.ues[i].tx_errors / metrics.stack.mac.ues[i].tx_pkts));
|
|
|
|
|
fmt::print(" {:>4}", mac.ues[i].tx_pkts - mac.ues[i].tx_errors);
|
|
|
|
|
fmt::print(" {:>4}", mac.ues[i].tx_errors);
|
|
|
|
|
if (mac.ues[i].tx_pkts > 0 && mac.ues[i].tx_errors) {
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * mac.ues[i].tx_errors / mac.ues[i].tx_pkts));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>3}%", 0);
|
|
|
|
|
}
|
|
|
|
@ -143,44 +124,66 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe
|
|
|
|
|
return sinr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (not isnan(metrics.phy[i].ul.pusch_sinr) and not iszero(metrics.phy[i].ul.pusch_sinr)) {
|
|
|
|
|
fmt::print(" {:>5.1f}", clamp_sinr(metrics.phy[i].ul.pusch_sinr));
|
|
|
|
|
if (not isnan(phy[i].ul.pusch_sinr) and not iszero(phy[i].ul.pusch_sinr)) {
|
|
|
|
|
fmt::print(" {:>5.1f}", clamp_sinr(phy[i].ul.pusch_sinr));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>5.5}", "n/a");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (not isnan(metrics.phy[i].ul.pucch_sinr) and not iszero(metrics.phy[i].ul.pucch_sinr)) {
|
|
|
|
|
fmt::print(" {:>5.1f}", clamp_sinr(metrics.phy[i].ul.pucch_sinr));
|
|
|
|
|
if (not isnan(phy[i].ul.pucch_sinr) and not iszero(phy[i].ul.pucch_sinr)) {
|
|
|
|
|
fmt::print(" {:>5.1f}", clamp_sinr(phy[i].ul.pucch_sinr));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>5.5}", "n/a");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt::print(" {:>3}", int(metrics.stack.mac.ues[i].phr));
|
|
|
|
|
if (not isnan(metrics.phy[i].ul.mcs)) {
|
|
|
|
|
fmt::print(" {:>2}", int(metrics.phy[i].ul.mcs));
|
|
|
|
|
fmt::print(" {:>3}", int(mac.ues[i].phr));
|
|
|
|
|
if (not isnan(phy[i].ul.mcs)) {
|
|
|
|
|
fmt::print(" {:>2}", int(phy[i].ul.mcs));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>2}", 0);
|
|
|
|
|
}
|
|
|
|
|
if (metrics.stack.mac.ues[i].rx_brate > 0) {
|
|
|
|
|
fmt::print(
|
|
|
|
|
" {:>6.6}",
|
|
|
|
|
float_to_eng_string((float)metrics.stack.mac.ues[i].rx_brate / (metrics.stack.mac.ues[i].nof_tti * 1e-3), 1));
|
|
|
|
|
if (mac.ues[i].rx_brate > 0) {
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string((float)mac.ues[i].rx_brate / (mac.ues[i].nof_tti * 1e-3), 1));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>6}", 0);
|
|
|
|
|
}
|
|
|
|
|
fmt::print(" {:>4}", metrics.stack.mac.ues[i].rx_pkts - metrics.stack.mac.ues[i].rx_errors);
|
|
|
|
|
fmt::print(" {:>4}", metrics.stack.mac.ues[i].rx_errors);
|
|
|
|
|
fmt::print(" {:>4}", mac.ues[i].rx_pkts - mac.ues[i].rx_errors);
|
|
|
|
|
fmt::print(" {:>4}", mac.ues[i].rx_errors);
|
|
|
|
|
|
|
|
|
|
if (metrics.stack.mac.ues[i].rx_pkts > 0 && metrics.stack.mac.ues[i].rx_errors > 0) {
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * metrics.stack.mac.ues[i].rx_errors / metrics.stack.mac.ues[i].rx_pkts));
|
|
|
|
|
if (mac.ues[i].rx_pkts > 0 && mac.ues[i].rx_errors > 0) {
|
|
|
|
|
fmt::print(" {:>3}%", int((float)100 * mac.ues[i].rx_errors / mac.ues[i].rx_pkts));
|
|
|
|
|
} else {
|
|
|
|
|
fmt::print(" {:>3}%", 0);
|
|
|
|
|
}
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string(metrics.stack.mac.ues[i].ul_buffer, 2));
|
|
|
|
|
fmt::print(" {:>6.6}", float_to_eng_string(mac.ues[i].ul_buffer, 2));
|
|
|
|
|
fmt::print("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t period_usec)
|
|
|
|
|
{
|
|
|
|
|
if (!do_print || enb == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (metrics.rf.rf_error) {
|
|
|
|
|
fmt::print("RF status: O={}, U={}, L={}\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (metrics.stack.rrc.ues.size() == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (++n_reports > 10) {
|
|
|
|
|
n_reports = 0;
|
|
|
|
|
fmt::print("\n");
|
|
|
|
|
fmt::print(" -----------------DL----------------|-------------------------UL-------------------------\n");
|
|
|
|
|
fmt::print("rnti cqi ri mcs brate ok nok (%) | pusch pucch phr mcs brate ok nok (%) bsr\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_metrics_helper(metrics.stack.rrc.ues.size(), metrics.stack.mac, metrics.phy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string metrics_stdout::float_to_string(float f, int digits, int field_width)
|
|
|
|
|
{
|
|
|
|
|
std::ostringstream os;
|
|
|
|
|