Normalize throughput in CSV/stdout metrics with respect to number of TTIs

master
Ismael Gomez 5 years ago committed by Andre Puschmann
parent 69d9914e0a
commit cf4f4508ce

@ -28,6 +28,7 @@ namespace srsenb {
struct mac_metrics_t { struct mac_metrics_t {
uint16_t rnti; uint16_t rnti;
uint32_t nof_tti;
int tx_pkts; int tx_pkts;
int tx_errors; int tx_errors;
int tx_brate; int tx_brate;

@ -94,6 +94,7 @@ public:
void metrics_dl_ri(uint32_t dl_cqi); void metrics_dl_ri(uint32_t dl_cqi);
void metrics_dl_pmi(uint32_t dl_cqi); void metrics_dl_pmi(uint32_t dl_cqi);
void metrics_dl_cqi(uint32_t dl_cqi); void metrics_dl_cqi(uint32_t dl_cqi);
void metrics_cnt();
bool is_phy_added = false; bool is_phy_added = false;
int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes); int read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_bytes);

@ -75,20 +75,20 @@ void metrics_csv::set_metrics(const enb_metrics_t& metrics, const uint32_t perio
// Sum up rates for all UEs // Sum up rates for all UEs
float dl_rate_sum = 0.0, ul_rate_sum = 0.0; float dl_rate_sum = 0.0, ul_rate_sum = 0.0;
for (int i = 0; i < metrics.stack.rrc.n_ues; i++) { for (int i = 0; i < metrics.stack.rrc.n_ues; i++) {
dl_rate_sum += metrics.stack.mac[i].tx_brate; dl_rate_sum += metrics.stack.mac[i].tx_brate / (metrics.stack.mac[i].nof_tti * 1e-3);
ul_rate_sum += metrics.stack.mac[i].rx_brate; ul_rate_sum += metrics.stack.mac[i].rx_brate / (metrics.stack.mac[i].nof_tti * 1e-3);
} }
// DL rate // DL rate
if (dl_rate_sum > 0) { if (dl_rate_sum > 0) {
file << float_to_string(SRSLTE_MAX(0.1, (float)dl_rate_sum / period_usec * 1e6), 2); file << float_to_string(SRSLTE_MAX(0.1, (float)dl_rate_sum), 2);
} else { } else {
file << float_to_string(0, 2); file << float_to_string(0, 2);
} }
// UL rate // UL rate
if (ul_rate_sum > 0) { if (ul_rate_sum > 0) {
file << float_to_string(SRSLTE_MAX(0.1, (float)ul_rate_sum / period_usec * 1e6), 2, false); file << float_to_string(SRSLTE_MAX(0.1, (float)ul_rate_sum), 2, false);
} else { } else {
file << float_to_string(0, 2, false); file << float_to_string(0, 2, false);
} }

@ -113,7 +113,8 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe
cout << float_to_string(0, 2, 4); cout << float_to_string(0, 2, 4);
} }
if (metrics.stack.mac[i].tx_brate > 0) { if (metrics.stack.mac[i].tx_brate > 0) {
cout << float_to_eng_string(SRSLTE_MAX(0.1, (float)metrics.stack.mac[i].tx_brate / period_usec * 1e6), 1); cout << float_to_eng_string(
SRSLTE_MAX(0.1, (float)metrics.stack.mac[i].tx_brate / (metrics.stack.mac[i].nof_tti * 1e-3)), 1);
} else { } else {
cout << float_to_string(0, 1, 6) << ""; cout << float_to_string(0, 1, 6) << "";
} }
@ -141,7 +142,8 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe
cout << float_to_string(0, 1, 4); cout << float_to_string(0, 1, 4);
} }
if (metrics.stack.mac[i].rx_brate > 0) { if (metrics.stack.mac[i].rx_brate > 0) {
cout << float_to_eng_string(SRSLTE_MAX(0.1, (float)metrics.stack.mac[i].rx_brate / period_usec * 1e6), 1); cout << float_to_eng_string(
SRSLTE_MAX(0.1, (float)metrics.stack.mac[i].rx_brate / (metrics.stack.mac[i].nof_tti * 1e-3)), 1);
} else { } else {
cout << float_to_string(0, 1) << ""; cout << float_to_string(0, 1) << "";
} }

@ -626,6 +626,11 @@ int mac::get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res_list)
dl_sched_res->cfi = sched_result.cfi; dl_sched_res->cfi = sched_result.cfi;
} }
// Count number of TTIs for all active users
for (auto& u : ue_db) {
u.second->metrics_cnt();
}
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

@ -614,4 +614,9 @@ void ue::metrics_tx(bool crc, uint32_t tbs)
metrics.tx_pkts++; metrics.tx_pkts++;
} }
void ue::metrics_cnt()
{
metrics.nof_tti++;
}
} // namespace srsenb } // namespace srsenb

@ -25,15 +25,16 @@
namespace srsue { namespace srsue {
struct mac_metrics_t { struct mac_metrics_t {
int tx_pkts; uint32_t nof_tti;
int tx_errors; int tx_pkts;
int tx_brate; int tx_errors;
int rx_pkts; int tx_brate;
int rx_errors; int rx_pkts;
int rx_brate; int rx_errors;
int ul_buffer; int rx_brate;
float dl_retx_avg; int ul_buffer;
float ul_retx_avg; float dl_retx_avg;
float ul_retx_avg;
}; };
} // namespace srsue } // namespace srsue

@ -103,7 +103,7 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
file << float_to_string(metrics.phy.dl[r].mcs, 2); file << float_to_string(metrics.phy.dl[r].mcs, 2);
file << float_to_string(metrics.phy.dl[r].sinr, 2); file << float_to_string(metrics.phy.dl[r].sinr, 2);
file << float_to_string(metrics.phy.dl[r].turbo_iters, 2); file << float_to_string(metrics.phy.dl[r].turbo_iters, 2);
file << float_to_string(metrics.stack.mac[r].rx_brate / (float)period_usec * 1e6f, 2); file << float_to_string(metrics.stack.mac[r].rx_brate / (metrics.stack.mac[r].nof_tti * 1e-3), 2);
int rx_pkts = metrics.stack.mac[r].rx_pkts; int rx_pkts = metrics.stack.mac[r].rx_pkts;
int rx_errors = metrics.stack.mac[r].rx_errors; int rx_errors = metrics.stack.mac[r].rx_errors;
@ -117,7 +117,7 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
file << float_to_string(metrics.phy.ul[r].mcs, 2); file << float_to_string(metrics.phy.ul[r].mcs, 2);
file << float_to_string((float)metrics.stack.mac[r].ul_buffer, 2); file << float_to_string((float)metrics.stack.mac[r].ul_buffer, 2);
file << float_to_string(metrics.stack.mac[r].tx_brate / (float)period_usec * 1e6f, 2); file << float_to_string(metrics.stack.mac[r].tx_brate / (metrics.stack.mac[r].nof_tti * 1e-3), 2);
// Sum UL BLER for all CCs // Sum UL BLER for all CCs
int tx_pkts = metrics.stack.mac[r].tx_pkts; int tx_pkts = metrics.stack.mac[r].tx_pkts;

@ -111,7 +111,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
cout << float_to_string(metrics.phy.dl[r].sinr, 2); cout << float_to_string(metrics.phy.dl[r].sinr, 2);
cout << float_to_string(metrics.phy.dl[r].turbo_iters, 2); cout << float_to_string(metrics.phy.dl[r].turbo_iters, 2);
cout << float_to_eng_string((float)metrics.stack.mac[r].rx_brate / period_usec * 1e6, 2); cout << float_to_eng_string((float)metrics.stack.mac[r].rx_brate / (metrics.stack.mac[r].nof_tti * 1e-3), 2);
if (metrics.stack.mac[r].rx_pkts > 0) { if (metrics.stack.mac[r].rx_pkts > 0) {
cout << float_to_string((float)100 * metrics.stack.mac[r].rx_errors / metrics.stack.mac[r].rx_pkts, 1) << "%"; cout << float_to_string((float)100 * metrics.stack.mac[r].rx_errors / metrics.stack.mac[r].rx_pkts, 1) << "%";
} else { } else {
@ -122,7 +122,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
cout << float_to_string(metrics.phy.ul[r].mcs, 2); cout << float_to_string(metrics.phy.ul[r].mcs, 2);
cout << float_to_eng_string((float)metrics.stack.mac[r].ul_buffer, 2); cout << float_to_eng_string((float)metrics.stack.mac[r].ul_buffer, 2);
cout << float_to_eng_string((float)metrics.stack.mac[r].tx_brate / period_usec * 1e6, 2); cout << float_to_eng_string((float)metrics.stack.mac[r].tx_brate / (metrics.stack.mac[r].nof_tti * 1e-3), 2);
if (metrics.stack.mac[r].tx_pkts > 0) { if (metrics.stack.mac[r].tx_pkts > 0) {
cout << float_to_string((float)100 * metrics.stack.mac[r].tx_errors / metrics.stack.mac[r].tx_pkts, 1) << "%"; cout << float_to_string((float)100 * metrics.stack.mac[r].tx_errors / metrics.stack.mac[r].tx_pkts, 1) << "%";
} else { } else {

@ -234,6 +234,11 @@ void mac::run_tti(const uint32_t tti)
ra_procedure.step(tti); ra_procedure.step(tti);
ra_procedure.update_rar_window(ra_window_start, ra_window_length); ra_procedure.update_rar_window(ra_window_start, ra_window_length);
// Count TTI for metrics
for (uint32_t i = 0; i < SRSLTE_MAX_CARRIERS; i++) {
metrics[i].nof_tti++;
}
} }
void mac::bcch_start_rx(int si_window_start_, int si_window_length_) void mac::bcch_start_rx(int si_window_start_, int si_window_length_)

Loading…
Cancel
Save