7 #include "TRACE/tracemf.h"
8 #define TRACE_NAME "test_metric"
10 #include "artdaq-utilities/Plugins/MetricMacros.hh"
12 #include "fhiclcpp/ParameterSet.h"
14 #include <sys/types.h>
32 explicit TestMetricImpl(fhicl::ParameterSet
const& config, std::string
const& app_name, std::string
const& metric_name)
50 std::string
getLibName()
const override {
return "test"; }
59 void sendMetric_(
const std::string& name,
const std::string& value,
const std::string& unit,
const std::chrono::system_clock::time_point& time)
override
64 METLOG(TLVL_TRACE) <<
"TestMetric: Adding MetricPoint name=" << name <<
", value=" << value <<
", unit=" << unit;
77 void sendMetric_(
const std::string& name,
const int& value,
const std::string& unit,
const std::chrono::system_clock::time_point& time)
override
79 sendMetric_(name, std::to_string(value), unit, time);
89 void sendMetric_(
const std::string& name,
const double& value,
const std::string& unit,
const std::chrono::system_clock::time_point& time)
override
91 sendMetric_(name, std::to_string(value), unit, time);
101 void sendMetric_(
const std::string& name,
const float& value,
const std::string& unit,
const std::chrono::system_clock::time_point& time)
override
103 sendMetric_(name, std::to_string(value), unit, time);
113 void sendMetric_(
const std::string& name,
const uint64_t& value,
const std::string& unit,
const std::chrono::system_clock::time_point& time)
override
115 sendMetric_(name, std::to_string(value), unit, time);
void startMetrics_() override
Perform startup actions.
void sendMetric_(const std::string &name, const uint64_t &value, const std::string &unit, const std::chrono::system_clock::time_point &time) override
Write metric data to memory.
The MetricPlugin class defines the interface that MetricManager uses to send metric data to the vario...
void startMetrics()
Perform startup actions. Simply calls the virtual startMetrics_ function.
void sendMetric_(const std::string &name, const double &value, const std::string &unit, const std::chrono::system_clock::time_point &time) override
Write metric data to memory.
TestMetricImpl(fhicl::ParameterSet const &config, std::string const &app_name, std::string const &metric_name)
TestMetric Constructor.
static void LockReceivedMetricMutex()
Lock the ReceivedMetricMutex
static std::list< MetricPoint > received_metrics
List of received metric data.
std::string getLibName() const override
Get the library name for the Test metric.
void stopMetrics()
Perform shutdown actions. Zeroes out all accumulators, and sends zeros for each metric. Calls stopMetrics_() for any plugin-defined shutdown actions.
TestMetric writes metric data to a statically-allocated memory block.
void sendMetric_(const std::string &name, const std::string &value, const std::string &unit, const std::chrono::system_clock::time_point &time) override
Write metric data to memory.
void sendMetric_(const std::string &name, const float &value, const std::string &unit, const std::chrono::system_clock::time_point &time) override
Write metric data to memory.
static void UnlockReceivedMetricMutex()
Unlock the ReceivedMetricMutex
void stopMetrics_() override
Perform shutdown actions.
bool inhibit_
Flag to indicate that the MetricPlugin is being stopped, and any metric back-ends which do not have a...
~TestMetricImpl() override
TestMetricImpl Destructor. Calls stopMetrics.
void sendMetric_(const std::string &name, const int &value, const std::string &unit, const std::chrono::system_clock::time_point &time) override
Write metric data to memory.
Describes a single metric point