inform all listeners about stop in metrics hub

master
Andre Puschmann 7 years ago
parent 253e7502e8
commit bf45ba32bf

@ -25,6 +25,7 @@ class metrics_listener
{
public:
virtual void set_metrics(metrics_t &m) = 0;
virtual void stop() = 0;
};
template<typename metrics_t>
@ -43,6 +44,10 @@ public:
return true;
}
void stop() {
// stop all listeners
for (uint32_t i=0;i<listeners.size();i++) {
listeners[i]->stop();
}
thread_cancel();
wait_thread_finish();
}

@ -52,6 +52,7 @@ public:
void set_periodicity(float metrics_report_period_sec);
void set_metrics(ue_metrics_t &m);
void set_ue_handle(ue_metrics_interface *ue_);
void stop();
private:
std::string float_to_string(float f, int digits, bool add_semicolon = true);

@ -50,6 +50,7 @@ public:
void toggle_print(bool b);
void set_metrics(ue_metrics_t &m);
void set_ue_handle(ue_metrics_interface *ue_);
void stop() {};
private:
std::string float_to_string(float f, int digits);

@ -51,11 +51,7 @@ metrics_csv::metrics_csv(std::string filename)
metrics_csv::~metrics_csv()
{
if (file.is_open()) {
file << "#eof\n";
file.flush();
file.close();
}
stop();
}
void metrics_csv::set_ue_handle(ue_metrics_interface *ue_)
@ -63,6 +59,15 @@ void metrics_csv::set_ue_handle(ue_metrics_interface *ue_)
ue = ue_;
}
void metrics_csv::stop()
{
if (file.is_open()) {
file << "#eof\n";
file.flush();
file.close();
}
}
void metrics_csv::set_periodicity(float metrics_report_period_sec) {
this->metrics_report_period = metrics_report_period_sec;
}

Loading…
Cancel
Save