artdaq_utilities  v1_05_00
artdaq::FileMetric Class Reference

FileMetric writes metric data to a file on disk. More...

Inheritance diagram for artdaq::FileMetric:
artdaq::MetricPlugin

Public Member Functions

 FileMetric (fhicl::ParameterSet const &config, std::string const &app_name)
 FileMetric Constructor. Opens the file and starts the metric. More...
 
virtual ~FileMetric ()
 FileMetric Destructor. Calls stopMetrics and then closes the file.
 
std::string getLibName () const override
 Get the library name for the File metric. More...
 
void sendMetric_ (const std::string &name, const std::string &value, const std::string &unit) override
 Write metric data to a file. More...
 
void sendMetric_ (const std::string &name, const int &value, const std::string &unit) override
 Write metric data to a file. More...
 
void sendMetric_ (const std::string &name, const double &value, const std::string &unit) override
 Write metric data to a file. More...
 
void sendMetric_ (const std::string &name, const float &value, const std::string &unit) override
 Write metric data to a file. More...
 
void sendMetric_ (const std::string &name, const unsigned long int &value, const std::string &unit) override
 Write metric data to a file. More...
 
void startMetrics_ () override
 Perform startup actions. Writes start message to output file.
 
void stopMetrics_ () override
 Perform shutdown actions. Writes stop message to output file.
 
- Public Member Functions inherited from artdaq::MetricPlugin
 MetricPlugin (fhicl::ParameterSet const &ps, std::string const &app_name)
 MetricPlugin Constructor. More...
 
virtual ~MetricPlugin ()=default
 Default virtual Desctructor.
 
void addMetricData (std::unique_ptr< MetricData > const &data)
 Send a metric value to the MetricPlugin. More...
 
void sendMetrics (bool forceSend=false, std::chrono::steady_clock::time_point interval_end=std::chrono::steady_clock::now())
 For each known metric, determine whether the reporting interval has elapsed, and if so, report a value to the underlying metric storage. More...
 
void startMetrics ()
 Perform startup actions. Simply calls the virtual startMetrics_ function.
 
void stopMetrics ()
 Perform shutdown actions. Zeroes out all accumulators, and sends zeros for each metric. Calls stopMetrics_() for any plugin-defined shutdown actions.
 
bool IsLevelEnabled (int level)
 Determine if the given level is enabled for this MetricPlugin instance. More...
 

Additional Inherited Members

- Public Types inherited from artdaq::MetricPlugin
using Parameters = fhicl::WrappedTable< Config >
 Used for ParameterSet validation (if desired)
 
- Protected Member Functions inherited from artdaq::MetricPlugin
virtual void sendMetric_ (const std::string &name, const long unsigned int &value, const std::string &unit)=0
 Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
 
- Protected Attributes inherited from artdaq::MetricPlugin
fhicl::ParameterSet pset
 The ParameterSet used to configure the MetricPlugin.
 
double accumulationTime_
 The amount of time to average metric values; except for accumulate=false metrics, will be the interval at which each metric is sent.
 
std::string app_name_
 Name of the application which is sending metrics to this plugin.
 
bool inhibit_
 Flag to indicate that the MetricPlugin is being stopped, and any metric back-ends which do not have a persistent state (i.e. file) should not report further metrics.
 
std::bitset< 64 > level_mask_
 Bitset indicating for each possible metric level, whether this plugin will receive those metrics.
 

Detailed Description

FileMetric writes metric data to a file on disk.

Definition at line 26 of file file_metric.cc.

Constructor & Destructor Documentation

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

FileMetric Constructor. Opens the file and starts the metric.

Parameters
configParameterSet used to configure FileMetric
app_nameName of the application sending metrics
* FileMetric accepts the following Parameters:
* "fileName" (Default: "FileMetric.out"): Name of the output file
* "absolute_file_path" (Default: true): Whether the fileName should be treated as an absolute path (default), or as relative to
* "relative_directory_env_var" (Default: ARTDAQ_LOG_ROOT): If fileName is not an absolute path (absolute_file_path: false), it will be treated as relative to the directory specified in this environment variable.
* "uniquify" (Default: false): If true, will replace %UID% with the PID of the current process, or append _%UID% to the end of the filename if %UID% is not present in fileName 
* "time_format" (Default: "%c"): Format to use for time printout (see std::put_time)
* "fileMode" (Default: "append"): Set to "Overwrite" to create a new file instead of appending 

Definition at line 69 of file file_metric.cc.

Member Function Documentation

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

Get the library name for the File metric.

Returns
The library name for the File metric, "file"

Reimplemented from artdaq::MetricPlugin.

Definition at line 122 of file file_metric.cc.

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

Write metric data to a file.

Parameters
nameName of the metric
valueValue of the metric
unitUnits of the metric

Implements artdaq::MetricPlugin.

Definition at line 130 of file file_metric.cc.

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

Write metric data to a file.

Parameters
nameName of the metric
valueValue of the metric
unitUnits of the metric

Implements artdaq::MetricPlugin.

Definition at line 144 of file file_metric.cc.

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

Write metric data to a file.

Parameters
nameName of the metric
valueValue of the metric
unitUnits of the metric

Implements artdaq::MetricPlugin.

Definition at line 155 of file file_metric.cc.

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

Write metric data to a file.

Parameters
nameName of the metric
valueValue of the metric
unitUnits of the metric

Implements artdaq::MetricPlugin.

Definition at line 166 of file file_metric.cc.

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

Write metric data to a file.

Parameters
nameName of the metric
valueValue of the metric
unitUnits of the metric

Definition at line 177 of file file_metric.cc.


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