artdaq_utilities  v1_04_10
artdaq::ProcFileMetric Class Reference

A MetricPlugin which writes a long unsigned int metric with a given name to a given pipe. More...

Inheritance diagram for artdaq::ProcFileMetric:
artdaq::MetricPlugin

Public Member Functions

 ProcFileMetric (fhicl::ParameterSet const &config, std::string const &app_name)
 ProcFileMetric Constructor. More...
 
 ~ProcFileMetric ()
 ProcFileMetric Destructor.
 
std::string getLibName () const override
 Get the "library name" of this Metric. More...
 
void sendMetric_ (const std::string &name, const std::string &value, const std::string &) override
 Set the value to be written to the pipe when it is opened by a reader. More...
 
void sendMetric_ (const std::string &name, const int &value, const std::string &unit) override
 Set the value to be written to the pipe when it is opened by a reader. More...
 
void sendMetric_ (const std::string &name, const double &value, const std::string &unit) override
 Set the value to be written to the pipe when it is opened by a reader. More...
 
void sendMetric_ (const std::string &name, const float &value, const std::string &unit) override
 Set the value to be written to the pipe when it is opened by a reader. More...
 
void sendMetric_ (const std::string &name, const unsigned long int &value, const std::string &unit) override
 Set the value to be written to the pipe when it is opened by a reader. More...
 
void startMetrics_ () override
 Start the metric-sending thread.
 
void stopMetrics_ () override
 Open the pipe for reading to allow the metric-sending thread to end gracefully.
 
void writePipe ()
 Wait for the pipe to be opened and then write the current value to it.
 
- Public Member Functions inherited from artdaq::MetricPlugin
 MetricPlugin (fhicl::ParameterSet const &ps, std::string const &app_name)
 
void addMetricData (std::unique_ptr< MetricData > const &data)
 
void sendMetrics (bool forceSend=false, std::chrono::steady_clock::time_point interval_end=std::chrono::steady_clock::now())
 
void startMetrics ()
 
void stopMetrics ()
 
void setRunLevel (int level)
 
int getRunLevel () const
 

Additional Inherited Members

- Public Types inherited from artdaq::MetricPlugin
using Parameters = fhicl::WrappedTable< Config >
 
- Protected Member Functions inherited from artdaq::MetricPlugin
virtual void sendMetric_ (const std::string &name, const long unsigned int &value, const std::string &unit)=0
 
- Protected Attributes inherited from artdaq::MetricPlugin
int runLevel_
 
fhicl::ParameterSet pset
 The ParameterSet used to configure the MetricPlugin.
 
double accumulationTime_
 
std::string app_name_
 Name of the application which is sending metrics to this plugin.
 
bool inhibit_
 Whether to inhibit all metric sending.
 

Detailed Description

A MetricPlugin which writes a long unsigned int metric with a given name to a given pipe.

This MetricPlugin emulates the function of the /proc file system, where the kernel provides access to various counters and parameters.

Definition at line 24 of file procFile_metric.cc.

Constructor & Destructor Documentation

artdaq::ProcFileMetric::ProcFileMetric ( fhicl::ParameterSet const &  config,
std::string const &  app_name 
)
inlineexplicit

ProcFileMetric Constructor.

Parameters
configFHiCL ParameterSet used to configure the ProcFileMetric
app_nameName of the application sending metrics
* ProcFileMetric accepts the following Parameters (in addition to those accepted by MetricPlugin):
* "pipe": Name of pipe virtual file to write to
* "name": Name of the metric to write to pipe
* 

Definition at line 43 of file procFile_metric.cc.

Member Function Documentation

std::string artdaq::ProcFileMetric::getLibName ( ) const
inlineoverridevirtual

Get the "library name" of this Metric.

Returns
The library name of this metric, "procFile"

Reimplemented from artdaq::MetricPlugin.

Definition at line 73 of file procFile_metric.cc.

void artdaq::ProcFileMetric::sendMetric_ ( const std::string &  name,
const std::string &  value,
const std::string &   
)
inlineoverridevirtual

Set the value to be written to the pipe when it is opened by a reader.

Parameters
nameName of the metric. Must match configred name for value to be updated (This MetricPlugin should be used with the useNameOverride parameter!)
valueValue of the metric.

Implements artdaq::MetricPlugin.

Definition at line 80 of file procFile_metric.cc.

void artdaq::ProcFileMetric::sendMetric_ ( const std::string &  name,
const int &  value,
const std::string &  unit 
)
inlineoverridevirtual

Set the value to be written to the pipe when it is opened by a reader.

Parameters
nameName of the metric. Must match configred name for value to be updated (This MetricPlugin should be used with the useNameOverride parameter!)
valueValue of the metric.
unitUnits of the metric.

Implements artdaq::MetricPlugin.

Definition at line 93 of file procFile_metric.cc.

void artdaq::ProcFileMetric::sendMetric_ ( const std::string &  name,
const double &  value,
const std::string &  unit 
)
inlineoverridevirtual

Set the value to be written to the pipe when it is opened by a reader.

Parameters
nameName of the metric. Must match configred name for value to be updated (This MetricPlugin should be used with the useNameOverride parameter!)
valueValue of the metric.
unitUnits of the metric.

Implements artdaq::MetricPlugin.

Definition at line 103 of file procFile_metric.cc.

void artdaq::ProcFileMetric::sendMetric_ ( const std::string &  name,
const float &  value,
const std::string &  unit 
)
inlineoverridevirtual

Set the value to be written to the pipe when it is opened by a reader.

Parameters
nameName of the metric. Must match configred name for value to be updated (This MetricPlugin should be used with the useNameOverride parameter!)
valueValue of the metric.
unitUnits of the metric.

Implements artdaq::MetricPlugin.

Definition at line 113 of file procFile_metric.cc.

void artdaq::ProcFileMetric::sendMetric_ ( const std::string &  name,
const unsigned long int &  value,
const std::string &  unit 
)
inlineoverride

Set the value to be written to the pipe when it is opened by a reader.

Parameters
nameName of the metric. Must match configred name for value to be updated (This MetricPlugin should be used with the useNameOverride parameter!)
valueValue of the metric.
unitUnits of the metric.

Definition at line 123 of file procFile_metric.cc.


The documentation for this class was generated from the following file: