senf::StatisticsBase Class Referenceabstract

Internal: Generic Statistics collection. More...

#include <senf/Utils/Statistics.hh>

Inheritance diagram for senf::StatisticsBase:

Classes

struct  DuplicateRankException
 
struct  InvalidRankException
 
class  OutputProxy
 Output connection interface. More...
 

Public Types

typedef boost::iterator_range< ValueIterator > CollectorRange
 
typedef boost::iterator_range< const_ValueIterator > const_CollectorRange
 

Public Member Functions

StatisticsData data () const
 Get the Statistics data as senf::StatisticsData. More...
 
void consoleList (unsigned level, std::ostream &os) const
 

Protected Member Functions

 StatisticsBase ()
 
virtual ~StatisticsBase ()
 
void enter (unsigned n, unsigned cnt, float min, float avg, float max, float dev)
 

Accessing the current value

unsigned cnt () const
 Last cnt value entered. More...
 
float min () const
 Last min value entered. More...
 
float avg () const
 Last avg value entered. More...
 
float max () const
 Last max value entered. More...
 
float dev () const
 Last dev value entered. More...
 
virtual unsigned rank () const
 Return collectors rank value. More...
 

Child collectors

Collectoroperator[] (unsigned rank)
 Get child collector. More...
 
Collector const & operator[] (unsigned rank) const
 Get child collector. More...
 
CollectorRange collectors ()
 List all child collectors. More...
 
const_CollectorRange collectors () const
 List all child collectors. More...
 
Collectorcollect (unsigned rank)
 Register a new collector. More...
 
Statistics const & base () const
 
Statisticsbase ()
 Get base statistics object. More...
 
std::string path () const
 Get the path to this collector. More...
 

Result generation

OutputProxy< StatisticsBaseoutput (unsigned n=1u)
 Register output. More...
 

Detailed Description

Internal: Generic Statistics collection.

Definition at line 59 of file Statistics.hh.

Member Typedef Documentation

◆ CollectorRange

typedef boost::iterator_range<ValueIterator> senf::StatisticsBase::CollectorRange

Definition at line 78 of file Statistics.hh.

◆ const_CollectorRange

typedef boost::iterator_range<const_ValueIterator> senf::StatisticsBase::const_CollectorRange

Definition at line 85 of file Statistics.hh.

Constructor & Destructor Documentation

◆ StatisticsBase()

senf::StatisticsBase::StatisticsBase ( )
protected

◆ ~StatisticsBase()

virtual senf::StatisticsBase::~StatisticsBase ( )
protectedvirtual

Member Function Documentation

◆ avg()

float senf::StatisticsBase::avg ( ) const

Last avg value entered.

◆ base() [1/2]

Statistics const& senf::StatisticsBase::base ( ) const

◆ base() [2/2]

Statistics& senf::StatisticsBase::base ( )

Get base statistics object.

Returns the base statistics object. If this is a child collector, this will return the outermost statistics object, otherwise it will return *this.

◆ cnt()

unsigned senf::StatisticsBase::cnt ( ) const

Last cnt value entered.

◆ collect()

senf::Collector & senf::StatisticsBase::collect ( unsigned  rank)

Register a new collector.

Adds a collector collecting rank values into each combined value.

Parameters
[in]ranknumber of values to collect
Returns
Reference to new collector
Exceptions
DuplicateRankExceptionif a collector collecting rank values already exists.

Definition at line 68 of file Statistics.cc.

◆ collectors() [1/2]

CollectorRange senf::StatisticsBase::collectors ( )

List all child collectors.

Returns
iterator range of child collector references

◆ collectors() [2/2]

const_CollectorRange senf::StatisticsBase::collectors ( ) const

List all child collectors.

Returns
iterator range of child collector references

◆ consoleList()

void senf::StatisticsBase::consoleList ( unsigned  level,
std::ostream &  os 
) const

Definition at line 93 of file Statistics.cc.

◆ data()

StatisticsData senf::StatisticsBase::data ( ) const

Get the Statistics data as senf::StatisticsData.

Return a Statistic Data object containing values from this instance.

◆ dev()

float senf::StatisticsBase::dev ( ) const

Last dev value entered.

◆ enter()

void senf::StatisticsBase::enter ( unsigned  n,
unsigned  cnt,
float  min,
float  avg,
float  max,
float  dev 
)
protected

Definition at line 36 of file Statistics.cc.

◆ max()

float senf::StatisticsBase::max ( ) const

Last max value entered.

◆ min()

float senf::StatisticsBase::min ( ) const

Last min value entered.

◆ operator[]() [1/2]

senf::Collector & senf::StatisticsBase::operator[] ( unsigned  rank)

Get child collector.

This member will return a reference to the collector collecting rank values.

Parameters
[in]rankNumber of values the requested collector collects into each combined value.
Exceptions
InvalidRankExceptionif rank is not a valid registered rank value.

Definition at line 51 of file Statistics.cc.

◆ operator[]() [2/2]

senf::Collector const & senf::StatisticsBase::operator[] ( unsigned  rank) const

Get child collector.

This member will return a const reference to the collector collecting rank values.

Parameters
[in]rankNumber of values the requested collector collects into each combined value.
Exceptions
InvalidRankExceptionif rank is not a valid registered rank value.

Definition at line 59 of file Statistics.cc.

◆ output()

senf::StatisticsBase::OutputProxy< senf::StatisticsBase > senf::StatisticsBase::output ( unsigned  n = 1u)

Register output.

This call will request the collector to output statistics build by averaging the last n values. This output is generated for every new value in the collector. The output signal can be connected to an arbitrary target using the returned proxy. Example:

stats.output(4u).connect(
senf::StatisticsLogger());
Parameters
[in]nsize of sliding average window

Definition at line 78 of file Statistics.cc.

◆ path()

std::string senf::StatisticsBase::path ( ) const

Get the path to this collector.

Returns the '-'-separated list of collectors up to here. If this is the basic statistics object, the value is empty, otherwise it is built by joining the collector ranks.

◆ rank()

virtual unsigned senf::StatisticsBase::rank ( ) const
virtual

Return collectors rank value.

Returns
number of basic values collected into each new value by this collector.

Reimplemented in senf::Collector.


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