[metrics] Added the system metrics to the csv

master
AlaiaL 4 years ago committed by Andre Puschmann
parent 0ba7cd7df9
commit d518a625cc

@ -119,7 +119,7 @@ static void calculate_percentage_memory(sys_metrics_t& metrics)
// Calculate the metrics.
metrics.process_realmem = 100.f * (float(metrics.process_realmem_kB) / total_mem_kB);
metrics.process_virtualmem = 100.f * (float(metrics.process_virtualmem) / total_mem_kB);
metrics.process_virtualmem = 100.f * (float(metrics.process_virtualmem_kB) / total_mem_kB);
metrics.system_mem = (1.f - float(available_mem_kB) / float(total_mem_kB)) * 100.f;
}

@ -55,7 +55,8 @@ void metrics_csv::set_metrics(const enb_metrics_t& metrics, const uint32_t perio
{
if (file.is_open() && enb != NULL) {
if (n_reports == 0) {
file << "time;nof_ue;dl_brate;ul_brate\n";
file << "time;nof_ue;dl_brate;ul_brate"
"proc_rmem;proc_rmem_kB;proc_vmem;proc_vmem_kB;sys_mem;proc_cpu;thread_count\n";
}
// Time
@ -80,11 +81,21 @@ void metrics_csv::set_metrics(const enb_metrics_t& metrics, const uint32_t perio
// UL rate
if (ul_rate_sum > 0) {
file << float_to_string(SRSLTE_MAX(0.1, (float)ul_rate_sum), 2, false);
file << float_to_string(SRSLTE_MAX(0.1, (float)ul_rate_sum), 2);
} else {
file << float_to_string(0, 2, false);
file << float_to_string(0, 2);
}
// Write system metrics.
const srslte::sys_metrics_t &m = metrics.sys;
file << float_to_string(m.process_realmem, 2);
file << std::to_string(m.process_realmem_kB) << ";";
file << float_to_string(m.process_virtualmem, 2);
file << std::to_string(m.process_virtualmem_kB) << ";" ;
file << float_to_string(m.system_mem, 2);
file << float_to_string(m.process_cpu_usage, 2);
file << std::to_string(m.thread_count);
file << "\n";
n_reports++;

@ -84,8 +84,8 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe
if (++n_reports > 10) {
n_reports = 0;
cout << endl;
cout << "------DL-------------------------------UL---------------------------------------------|----SYS----" << endl;
cout << "rnti cqi ri mcs brate ok nok (%) pusch pucch phr mcs brate ok nok (%) bsr cpu mem" << endl;
cout << "------DL-------------------------------UL--------------------------------------------" << endl;
cout << "rnti cqi ri mcs brate ok nok (%) pusch pucch phr mcs brate ok nok (%) bsr" << endl;
}
for (size_t i = 0; i < metrics.stack.rrc.ues.size(); i++) {
@ -162,10 +162,6 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe
}
cout << float_to_eng_string(metrics.stack.mac.ues[i].ul_buffer, 2);
// Write the system metrics.
cout << float_to_string(metrics.sys.process_cpu_usage, 2);
cout << float_to_string(metrics.sys.process_realmem, 2);
cout << endl;
}

@ -77,7 +77,8 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
"ul_ta;ul_mcs;ul_buff;ul_brate;ul_"
"bler;"
"rf_o;rf_"
"u;rf_l;is_attached\n";
"u;rf_l;is_attached;"
"proc_rmem;proc_rmem_kB;proc_vmem;proc_vmem_kB;sys_mem;proc_cpu;thread_count\n";
}
for (uint32_t r = 0; r < metrics.phy.nof_active_cc; r++) {
@ -150,7 +151,18 @@ void metrics_csv::set_metrics(const ue_metrics_t& metrics, const uint32_t period
file << float_to_string(metrics.rf.rf_o, 2);
file << float_to_string(metrics.rf.rf_u, 2);
file << float_to_string(metrics.rf.rf_l, 2);
file << (metrics.stack.rrc.state == RRC_STATE_CONNECTED ? "1.0" : "0.0");
file << (metrics.stack.rrc.state == RRC_STATE_CONNECTED ? "1.0" : "0.0") << ";";
// Write system metrics.
const srslte::sys_metrics_t &m = metrics.sys;
file << float_to_string(m.process_realmem, 2);
file << std::to_string(m.process_realmem_kB) << ";";
file << float_to_string(m.process_virtualmem, 2);
file << std::to_string(m.process_virtualmem_kB) << ";" ;
file << float_to_string(m.system_mem, 2);
file << float_to_string(m.process_cpu_usage, 2);
file << std::to_string(m.thread_count);
file << "\n";
}

@ -64,17 +64,15 @@ void metrics_stdout::toggle_print(bool b)
void metrics_stdout::print_table(const bool display_neighbours)
{
if (display_neighbours) {
cout << "--------Signal-------------Neighbour--DL-------------------------------------UL-----------------------|---"
"--SYS-----"
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 "
"cpu mem"
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----------------------|-----SYS----"
cout << "--------Signal--------------DL-------------------------------------UL----------------------"
"--"
<< endl;
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler cpu mem"
cout << "cc pci rsrp pl cfo mcs snr turbo brate bler ta_us mcs buff brate bler"
<< endl;
}
table_has_neighbours = display_neighbours;
@ -167,10 +165,7 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
} else {
cout << float_to_string(0, 1) << "%";
}
// Write the system metrics.
cout << float_to_string(metrics.sys.process_cpu_usage, 3);
cout << float_to_string(metrics.sys.process_realmem, 3);
cout << endl;
}

Loading…
Cancel
Save