artdaq::MonitoredQuantity Class Reference

This class keeps track of statistics for a set of sample values and provides timing information on the samples. More...

#include <artdaq-core/Core/MonitoredQuantity.hh>

Inheritance diagram for artdaq::MonitoredQuantity:
artdaq::MonitoredQuantityStats

List of all members.

Public Member Functions

 MonitoredQuantity (DURATION_T expectedCalculationInterval, DURATION_T timeWindowForRecentResults)
 Instantiates a MonitoredQuantity object.
void addSample (const double value=1.0)
 Adds the specified doubled valued sample value to the monitor instance.
void addSample (const int value=1)
 Adds the specified integer valued sample value to the monitor instance.
void addSample (const uint32_t value=1)
 Adds the specified uint32_t valued sample value to the monitor instance.
void addSample (const uint64_t value=1)
 Adds the specified uint64_t valued sample value to the monitor instance.
bool calculateStatistics (TIME_POINT_T currentTime=getCurrentTime())
 Forces a calculation of the statistics for the monitored quantity.
void reset ()
void enable ()
void disable ()
bool isEnabled () const
 Tests whether the monitor is currently enabled.
void setNewTimeWindowForRecentResults (DURATION_T interval)
 Specifies a new time interval to be used when calculating "recent" statistics.
DURATION_T getTimeWindowForRecentResults () const
 Returns the length of the time window that has been specified for recent results.
DURATION_T ExpectedCalculationInterval () const
 Returns the expected interval between calculateStatistics calls.
bool waitUntilAccumulatorsHaveBeenFlushed (DURATION_T timeout) const
 Blocks while the MonitoredQuantity is flushed, up to timeout duration.
void getStats (MonitoredQuantityStats &stats) const
 Write all our collected statistics into the given Stats struct.
TIME_POINT_T getLastCalculationTime () const
 Access the last calculation time.
DURATION_T getFullDuration () const
 Access the full duration of the statistics.
double getRecentValueSum () const
 Access the sum of the value samples in the "recent" time span.
double getRecentValueAverage () const
 Access the average of the value samples in the "recent" time span.
long long getFullSampleCount () const
 Access the count of samples for the entire history of the MonitoredQuantity.

Static Public Member Functions

static TIME_POINT_T getCurrentTime ()
 Returns the current point in time.

Detailed Description

This class keeps track of statistics for a set of sample values and provides timing information on the samples.

Definition at line 158 of file MonitoredQuantity.hh.


Constructor & Destructor Documentation

MonitoredQuantity::MonitoredQuantity ( DURATION_T  expectedCalculationInterval,
DURATION_T  timeWindowForRecentResults 
) [explicit]

Instantiates a MonitoredQuantity object.

Parameters:
expectedCalculationInterval How often calculateStatistics is expected to be called
timeWindowForRecentResults Defines the meaning of DataSetType::RECENT

Definition at line 9 of file MonitoredQuantity.cc.


Member Function Documentation

void MonitoredQuantity::addSample ( const uint64_t  value = 1  ) 

Adds the specified uint64_t valued sample value to the monitor instance.

Parameters:
value The sample value to add

Definition at line 45 of file MonitoredQuantity.cc.

void MonitoredQuantity::addSample ( const uint32_t  value = 1  ) 

Adds the specified uint32_t valued sample value to the monitor instance.

Parameters:
value The sample value to add

Definition at line 40 of file MonitoredQuantity.cc.

void MonitoredQuantity::addSample ( const int  value = 1  ) 

Adds the specified integer valued sample value to the monitor instance.

Parameters:
value The sample value to add

Definition at line 35 of file MonitoredQuantity.cc.

void MonitoredQuantity::addSample ( const double  value = 1.0  ) 

Adds the specified doubled valued sample value to the monitor instance.

Parameters:
value The sample value to add

Definition at line 19 of file MonitoredQuantity.cc.

bool MonitoredQuantity::calculateStatistics ( TIME_POINT_T  currentTime = getCurrentTime()  ) 

Forces a calculation of the statistics for the monitored quantity.

Parameters:
currentTime Time point to use for calculating statistics (if synchronized at a higher level)
Returns:
Whether the statisics were calculated

Forces a calculation of the statistics for the monitored quantity. The frequency of the updates to the statistics is driven by how often this method is called. It is expected that this method will be called once per interval specified by expectedCalculationInterval

Definition at line 50 of file MonitoredQuantity.cc.

void MonitoredQuantity::disable (  ) 

Disables the monitor.

Definition at line 274 of file MonitoredQuantity.cc.

void MonitoredQuantity::enable (  ) 

Enables the monitor (and resets the statistics to provide a fresh start).

Definition at line 265 of file MonitoredQuantity.cc.

DURATION_T artdaq::MonitoredQuantity::ExpectedCalculationInterval (  )  const [inline]

Returns the expected interval between calculateStatistics calls.

Returns:
The expected interval between calculateStatistics calls

Definition at line 259 of file MonitoredQuantity.hh.

MonitoredQuantity::TIME_POINT_T MonitoredQuantity::getCurrentTime (  )  [static]

Returns the current point in time.

Returns:
The current point in time.

Returns the current point in time. A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 381 of file MonitoredQuantity.cc.

void MonitoredQuantity::getStats ( MonitoredQuantityStats stats  )  const

Write all our collected statistics into the given Stats struct.

Parameters:
stats Destination for copy of collected statistics

Definition at line 338 of file MonitoredQuantity.cc.

DURATION_T artdaq::MonitoredQuantity::getTimeWindowForRecentResults (  )  const [inline]

Returns the length of the time window that has been specified for recent results.

Returns:
The length of the time windows for recent results

Returns the length of the time window that has been specified for recent results. (This may be different than the actual length of the recent time window which is affected by the interval of calls to the calculateStatistics() method. Use a getDuration(RECENT) call to determine the actual recent time window.)

Definition at line 250 of file MonitoredQuantity.hh.

bool artdaq::MonitoredQuantity::isEnabled (  )  const [inline]

Tests whether the monitor is currently enabled.

Returns:
Whether the monitor is currently enabled.

Reimplemented from artdaq::MonitoredQuantityStats.

Definition at line 230 of file MonitoredQuantity.hh.

void MonitoredQuantity::reset (  ) 

Resets the monitor (zeroes out all counters and restarts the time interval).

Definition at line 253 of file MonitoredQuantity.cc.

void MonitoredQuantity::setNewTimeWindowForRecentResults ( DURATION_T  interval  ) 

Specifies a new time interval to be used when calculating "recent" statistics.

Parameters:
interval The new time interval for calculating "recent" statistics.

Definition at line 281 of file MonitoredQuantity.cc.

bool MonitoredQuantity::waitUntilAccumulatorsHaveBeenFlushed ( DURATION_T  timeout  )  const

Blocks while the MonitoredQuantity is flushed, up to timeout duration.

Parameters:
timeout How long to wait for the MonitoredQuantity to be emptied, in seconds
Returns:
Whether the MonitoredQuantity was emptied within the specified timeout

Definition at line 318 of file MonitoredQuantity.cc.


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

Generated on 3 May 2018 for artdaq_core by  doxygen 1.6.1