geopm
3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
|
Class to track the average value of a signal while a condition is true. More...
#include <Accumulator.hpp>
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< AvgAccumulator > | make_unique (void) |
Factory constructor. More... | |
Protected Member Functions | |
AvgAccumulator ()=default | |
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().
|
virtualdefault |
Virtual destructor.
|
protecteddefault |
|
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.
Implemented in geopm::AvgAccumulatorImp.
|
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.
|
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.
|
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.
Implemented in geopm::AvgAccumulatorImp.
|
static |
Factory constructor.
|
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.
[in] | delta_time | Change in the time over the control interval. |
[in] | signal | Value of the signal being tracked. |
Implemented in geopm::AvgAccumulatorImp.