libstatistics_collector  master
Lightweight aggregation utilities to collect statistics and measure message metrics.
Public Member Functions | List of all members
libstatistics_collector::collector::Collector Class Referenceabstract

#include <collector.hpp>

Inheritance diagram for libstatistics_collector::collector::Collector:
Inheritance graph
[legend]
Collaboration diagram for libstatistics_collector::collector::Collector:
Collaboration graph
[legend]

Public Member Functions

 Collector ()=default
 
virtual ~Collector ()=default
 
virtual void AcceptData (const double measurement)
 
virtual moving_average_statistics::StatisticData GetStatisticsResults () const
 
virtual void ClearCurrentMeasurements ()
 
bool IsStarted () const
 
virtual std::string GetStatusString () const
 
virtual bool Start ()
 
virtual bool Stop ()
 
- Public Member Functions inherited from libstatistics_collector::collector::MetricDetailsInterface
virtual ~MetricDetailsInterface ()=default
 
virtual std::string GetMetricName () const =0
 
virtual std::string GetMetricUnit () const =0
 

Detailed Description

Simple class in order to collect observed data and generate statistics for the given observations.

Constructor & Destructor Documentation

◆ Collector()

libstatistics_collector::collector::Collector::Collector ( )
default

◆ ~Collector()

virtual libstatistics_collector::collector::Collector::~Collector ( )
virtualdefault

Member Function Documentation

◆ AcceptData()

virtual void libstatistics_collector::collector::Collector::AcceptData ( const double  measurement)
virtual

Add an observed measurement. This aggregates the measurement and calculates statistics via the moving_average class.

Parameters
themeasurement observed

◆ GetStatisticsResults()

virtual moving_average_statistics::StatisticData libstatistics_collector::collector::Collector::GetStatisticsResults ( ) const
virtual

Return the statistics for all of the observed data.

Returns
the StatisticData for all the observed measurements

◆ ClearCurrentMeasurements()

virtual void libstatistics_collector::collector::Collector::ClearCurrentMeasurements ( )
virtual

Clear / reset all current measurements.

◆ IsStarted()

bool libstatistics_collector::collector::Collector::IsStarted ( ) const

Return true is start has been called, false otherwise.

Returns
the started state of this collector

◆ GetStatusString()

virtual std::string libstatistics_collector::collector::Collector::GetStatusString ( ) const
virtual

Return a pretty printed status representation of this class

Returns
a string detailing the current status

◆ Start()

virtual bool libstatistics_collector::collector::Collector::Start ( )
virtual

Start collecting data. Meant to be called after construction. Note: this locks the recursive mutex class member 'mutex'. This method is public in order for the caller to manually manage starting and stopping this collector.

Returns
true if started, false if an error occurred

◆ Stop()

virtual bool libstatistics_collector::collector::Collector::Stop ( )
virtual

Stop collecting data. Meant to be a teardown method (before destruction, but should place the class in a restartable state, i.e., start can be called to be able to resume collection. This method is public in order for the caller to manually manage starting and stopping this collector.

This calls ClearCurrentMeasurements.

Returns
true if stopped, false if an error occurred

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