diff --git a/srsenb/hdr/metrics_csv.h b/srsenb/hdr/metrics_csv.h index 4cda5927d..89adc0879 100644 --- a/srsenb/hdr/metrics_csv.h +++ b/srsenb/hdr/metrics_csv.h @@ -32,11 +32,10 @@ namespace srsenb { class metrics_csv : public srsran::metrics_listener { public: - metrics_csv(std::string filename); + metrics_csv(std::string filename, enb_metrics_interface* enb_); ~metrics_csv(); void set_metrics(const enb_metrics_t& m, const uint32_t period_usec); - void set_handle(enb_metrics_interface* enb_); void stop(); private: diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 8fa2bd5a7..9a8e79d24 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -632,10 +632,9 @@ int main(int argc, char* argv[]) metricshub.add_listener(&metrics_screen); metrics_screen.set_handle(enb.get()); - srsenb::metrics_csv metrics_file(args.general.metrics_csv_filename); + srsenb::metrics_csv metrics_file(args.general.metrics_csv_filename, enb.get()); if (args.general.metrics_csv_enable) { metricshub.add_listener(&metrics_file); - metrics_file.set_handle(enb.get()); } srsenb::metrics_json json_metrics(json_channel, enb.get()); diff --git a/srsenb/src/metrics_csv.cc b/srsenb/src/metrics_csv.cc index 779eb8d22..2afbe5892 100644 --- a/srsenb/src/metrics_csv.cc +++ b/srsenb/src/metrics_csv.cc @@ -27,7 +27,8 @@ using namespace std; namespace srsenb { -metrics_csv::metrics_csv(std::string filename) : n_reports(0), metrics_report_period(1.0), enb(NULL) +metrics_csv::metrics_csv(std::string filename, enb_metrics_interface* enb_) : + n_reports(0), metrics_report_period(1.0), enb(enb_) { file.open(filename.c_str(), std::ios_base::out); } @@ -37,11 +38,6 @@ metrics_csv::~metrics_csv() stop(); } -void metrics_csv::set_handle(enb_metrics_interface* enb_) -{ - enb = enb_; -} - void metrics_csv::stop() { if (file.is_open()) { diff --git a/srsenb/test/enb_metrics_test.cc b/srsenb/test/enb_metrics_test.cc index 5e877e67e..5afd87f35 100644 --- a/srsenb/test/enb_metrics_test.cc +++ b/srsenb/test/enb_metrics_test.cc @@ -53,8 +53,8 @@ public: metrics[0].stack.mac.ues[0].dl_pmi = 1.0; metrics[0].stack.mac.ues[0].phr = 12.0; metrics[0].phy.resize(2); - metrics[0].phy[0].dl.mcs = 28.0; - metrics[0].phy[0].ul.mcs = 20.2; + metrics[0].phy[0].dl.mcs = 28.0; + metrics[0].phy[0].ul.mcs = 20.2; metrics[0].phy[0].ul.pucch_sinr = 14.2; metrics[0].phy[0].ul.pusch_sinr = 14.2; @@ -96,8 +96,8 @@ public: metrics[1].stack.mac.ues[0].dl_pmi = 1.0; metrics[1].stack.mac.ues[0].phr = 99.1; metrics[1].phy.resize(1); - metrics[1].phy[0].dl.mcs = 6.2; - metrics[1].phy[0].ul.mcs = 28.0; + metrics[1].phy[0].dl.mcs = 6.2; + metrics[1].phy[0].ul.mcs = 28.0; metrics[1].phy[0].ul.pucch_sinr = 22.2; metrics[1].phy[0].ul.pusch_sinr = 22.2; @@ -119,8 +119,8 @@ public: metrics[2].stack.mac.ues[0].dl_pmi = 1.0; metrics[2].stack.mac.ues[0].phr = 12.0; metrics[2].phy.resize(1); - metrics[2].phy[0].dl.mcs = 28.0; - metrics[2].phy[0].ul.mcs = 20.2; + metrics[2].phy[0].dl.mcs = 28.0; + metrics[2].phy[0].ul.mcs = 20.2; metrics[2].phy[0].ul.pusch_sinr = 14.2; metrics[2].phy[0].ul.pucch_sinr = 14.2; @@ -201,8 +201,7 @@ int main(int argc, char** argv) metrics_screen.set_handle(&enb); // the CSV file writer - metrics_csv metrics_file(csv_file_name); - metrics_file.set_handle(&enb); + metrics_csv metrics_file(csv_file_name, &enb); // create metrics hub and register metrics for stdout srsran::metrics_hub metricshub;