geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
geopm::AvgAccumulator Class Referenceabstract

Class to track the average value of a signal while a condition is true. More...

#include <Accumulator.hpp>

Inheritance diagram for geopm::AvgAccumulator:
Inheritance graph
[legend]

Public Member Functions

virtual ~AvgAccumulator ()=default
 Virtual destructor. More...
 
virtual void update (double delta_time, double signal)=0
 Called in control loop to update state. More...
 
virtual void enter (void)=0
 Mark the beginning of an interval. More...
 
virtual void exit (void)=0
 Mark the end of an interval. More...
 
virtual double average (void) const =0
 Average of the signal tracked while the condition is true. More...
 
virtual double interval_average (void) const =0
 Average of the signal tracked while the condition is true. More...
 

Static Public Member Functions

static std::unique_ptr< AvgAccumulatormake_unique (void)
 Factory constructor. More...
 

Protected Member Functions

 AvgAccumulator ()=default
 

Detailed Description

Class to track the average value of a signal while a condition is true.

The AvgAccumulator is used to provide the average value of a signal while a condition is true, e.g. while the application was executing a particular region.

Each of these objects is specific to a particular signal, and it is also particular to a condition that is being tracked. This condition may be: a particular region being profiled by the application, the epoch events, or the hint signal. The user only calls the update() method when the condition is true (e.g. the application is within the tracked region). The enter() and exit() API's are used to track values for the last occurrence of the condition being true. It is expected (though not enforced) that one call to enter() proceeds each call to exit(), and these are used to update the values returned by interval_average().

Constructor & Destructor Documentation

◆ ~AvgAccumulator()

virtual geopm::AvgAccumulator::~AvgAccumulator ( )
virtualdefault

Virtual destructor.

◆ AvgAccumulator()

geopm::AvgAccumulator::AvgAccumulator ( )
protecteddefault

Member Function Documentation

◆ average()

virtual double geopm::AvgAccumulator::average ( void  ) const
pure virtual

Average of the signal tracked while the condition is true.

Get the average value of the signal being tracked when the condition was true. This average is weighted by the duration of the control loop when each update() call was made.

Returns
Time weighted average of the signal being tracked while the condition is true.

Implemented in geopm::AvgAccumulatorImp.

◆ enter()

virtual void geopm::AvgAccumulator::enter ( void  )
pure virtual

Mark the beginning of an interval.

Used to mark the beginning of an interval used for the interval_average() reporting. The next call to exit() will close the interval and update the value returned by interval_average() to reflect the interval between the enter() and exit() calls.

Implemented in geopm::AvgAccumulatorImp.

◆ exit()

virtual void geopm::AvgAccumulator::exit ( void  )
pure virtual

Mark the end of an interval.

Used to mark the end of an interval that was previously started with a call to the enter() API. The call to exit() will update the value returned by interval_average() to reflect the interval since the enter() call.

Implemented in geopm::AvgAccumulatorImp.

◆ interval_average()

virtual double geopm::AvgAccumulator::interval_average ( void  ) const
pure virtual

Average of the signal tracked while the condition is true.

Get the average value of the signal being tracked when the condition was true over the last interval. This average is weighted by the duration of the control loop when each update() call was made, and limited to the updates() made during the last enter()/exit() interval.

Returns
Time weighted average of the signal being tracked while the condition is true over the last interval.

Implemented in geopm::AvgAccumulatorImp.

◆ make_unique()

std::unique_ptr< AvgAccumulator > geopm::AvgAccumulator::make_unique ( void  )
static

Factory constructor.

◆ update()

virtual void geopm::AvgAccumulator::update ( double  delta_time,
double  signal 
)
pure virtual

Called in control loop to update state.

Update with the time interval and the value of the signal being tracked. This is called once in each control interval where the condition is true. The change in the time is measured over the period of the last control interval.

Parameters
[in]delta_timeChange in the time over the control interval.
[in]signalValue of the signal being tracked.

Implemented in geopm::AvgAccumulatorImp.


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