[metrics] Added system metrics to the enb's stdout

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

@ -20,6 +20,7 @@
#include "srsenb/hdr/stack/rrc/rrc_metrics.h" #include "srsenb/hdr/stack/rrc/rrc_metrics.h"
#include "srsenb/hdr/stack/upper/common_enb.h" #include "srsenb/hdr/stack/upper/common_enb.h"
#include "srsenb/hdr/stack/upper/s1ap_metrics.h" #include "srsenb/hdr/stack/upper/s1ap_metrics.h"
#include "srslte/system/sys_metrics.h"
#include "srslte/common/metrics_hub.h" #include "srslte/common/metrics_hub.h"
#include "srslte/radio/radio_metrics.h" #include "srslte/radio/radio_metrics.h"
#include "srslte/upper/pdcp_metrics.h" #include "srslte/upper/pdcp_metrics.h"
@ -48,6 +49,7 @@ struct enb_metrics_t {
srslte::rf_metrics_t rf; srslte::rf_metrics_t rf;
std::vector<phy_metrics_t> phy; std::vector<phy_metrics_t> phy;
stack_metrics_t stack; stack_metrics_t stack;
srslte::sys_metrics_t sys;
bool running; bool running;
}; };

@ -87,7 +87,6 @@ float sys_metrics_processor::cpu_usage(const proc_stats_info& current_query, flo
static const unsigned cpu_count = ::sysconf(_SC_NPROCESSORS_CONF); static const unsigned cpu_count = ::sysconf(_SC_NPROCESSORS_CONF);
static const float ticks_per_second = ::sysconf(_SC_CLK_TCK); static const float ticks_per_second = ::sysconf(_SC_CLK_TCK);
printf("delta time is: %f\n", delta_time_in_seconds);
return ((current_query.stime + current_query.utime) - (last_query.stime + last_query.utime)) * 100.f / return ((current_query.stime + current_query.utime) - (last_query.stime + last_query.utime)) * 100.f /
(cpu_count * ticks_per_second * delta_time_in_seconds); (cpu_count * ticks_per_second * delta_time_in_seconds);
} }

@ -31,6 +31,7 @@
#include "srsenb/hdr/stack/enb_stack_base.h" #include "srsenb/hdr/stack/enb_stack_base.h"
#include "srsenb/hdr/stack/rrc/rrc_config.h" #include "srsenb/hdr/stack/rrc/rrc_config.h"
#include "srslte/system/sys_metrics_processor.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/buffer_pool.h" #include "srslte/common/buffer_pool.h"
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
@ -150,6 +151,9 @@ private:
std::unique_ptr<srslte::radio_base> radio = nullptr; std::unique_ptr<srslte::radio_base> radio = nullptr;
std::unique_ptr<enb_phy_base> phy = nullptr; std::unique_ptr<enb_phy_base> phy = nullptr;
// System metrics processor.
srslte::sys_metrics_processor sys_proc;
srslte::LOG_LEVEL_ENUM level(std::string l); srslte::LOG_LEVEL_ENUM level(std::string l);
std::string get_build_mode(); std::string get_build_mode();

@ -25,8 +25,8 @@ target_link_libraries(enb_cfg_parser ${LIBCONFIGPP_LIBRARIES})
add_executable(srsenb main.cc enb.cc metrics_stdout.cc metrics_csv.cc metrics_json.cc) add_executable(srsenb main.cc enb.cc metrics_stdout.cc metrics_csv.cc metrics_json.cc)
set(SRSENB_SOURCES srsenb_phy srsenb_stack srsenb_upper srsenb_mac srsenb_rrc srslog) set(SRSENB_SOURCES srsenb_phy srsenb_stack srsenb_upper srsenb_mac srsenb_rrc srslog system)
set(SRSLTE_SOURCES srslte_common srslte_mac srslte_phy srslte_upper srslte_radio rrc_asn1 s1ap_asn1 enb_cfg_parser srslog) set(SRSLTE_SOURCES srslte_common srslte_mac srslte_phy srslte_upper srslte_radio rrc_asn1 s1ap_asn1 enb_cfg_parser srslog system)
set(SRSENB_SOURCES ${SRSENB_SOURCES} srsgnb_phy srsgnb_stack srsgnb_upper srsgnb_mac srsgnb_rrc) set(SRSENB_SOURCES ${SRSENB_SOURCES} srsgnb_phy srsgnb_stack srsgnb_upper srsgnb_mac srsgnb_rrc)
set(SRSLTE_SOURCES ${SRSLTE_SOURCES} rrc_nr_asn1 ngap_nr_asn1) set(SRSLTE_SOURCES ${SRSLTE_SOURCES} rrc_nr_asn1 ngap_nr_asn1)

@ -200,6 +200,7 @@ bool enb::get_metrics(enb_metrics_t* m)
phy->get_metrics(m->phy); phy->get_metrics(m->phy);
stack->get_metrics(&m->stack); stack->get_metrics(&m->stack);
m->running = started; m->running = started;
m->sys = sys_proc.get_metrics();
return true; return true;
} }

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

@ -169,8 +169,8 @@ void metrics_stdout::set_metrics(const ue_metrics_t& metrics, const uint32_t per
} }
// Write the system metrics. // Write the system metrics.
cout << float_to_string(metrics.sys.process_cpu_usage, 2); cout << float_to_string(metrics.sys.process_cpu_usage, 3);
cout << float_to_string(metrics.sys.system_mem, 2); cout << float_to_string(metrics.sys.process_realmem, 3);
cout << endl; cout << endl;
} }

Loading…
Cancel
Save