geopm
3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
|
Class to track the total increase of a signal while a condition is true. More...
#include <Accumulator.hpp>
Public Member Functions | |
virtual | ~SumAccumulator ()=default |
Virtual destructor. More... | |
virtual void | update (double delta_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 | total (void) const =0 |
Total increase of tracked signal when condition is true. More... | |
virtual double | interval_total (void) const =0 |
Increase of tracked signal over last interval. More... | |
Static Public Member Functions | |
static std::unique_ptr< SumAccumulator > | make_unique (void) |
Factory constructor. More... | |
Protected Member Functions | |
SumAccumulator ()=default | |
Class to track the total increase of a signal while a condition is true.
There are many monotonically increasing signals provided by PlatformIO, for example: CPU_ENERGY, CPU_CYCLES_THREAD, and CPU_CYCLES_REFERENCE. It is useful to track the amount that these signals increase while a condition is true. In the common case, the condition is that the application is executing a particular region of code. An example use for a SumAccumulator object is to track the increase in the amount of package energy consumed while the application was executing a particular region.
The SumAccumulator is used to accumulate a signal that is monotonically increasing, e.g. energy, in order to track the portion of the total increase that occurred while the condition is true, e.g. while the application was executing a particular region.
Each of these objects is specific to a signal, and it is also particular to a condition that is being tracked. This condition may be: the application is executing a particular profiled region, or the hint signal has a particular value. 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_total().
|
virtualdefault |
Virtual destructor.
|
protecteddefault |
|
pure virtual |
Mark the beginning of an interval.
Used to mark the beginning of an interval used for the interval_total() reporting. The next call to exit() will close the interval and update the value returned by interval_total() to reflect the interval between the enter() and exit() calls.
Implemented in geopm::SumAccumulatorImp.
|
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_total() to reflect the interval since the enter() call.
Implemented in geopm::SumAccumulatorImp.
|
pure virtual |
Increase of tracked signal over last interval.
Get the increase in the signal while the condition is true over the last interval. An interval is defined by an enter() and exit() call.
Implemented in geopm::SumAccumulatorImp.
|
static |
Factory constructor.
|
pure virtual |
Total increase of tracked signal when condition is true.
Used to report on the total accumulated sum of all of the updates since the construction of the object.
Implemented in geopm::SumAccumulatorImp.
|
pure virtual |
Called in control loop to update state.
Update with the change in the signal being tracked for the sample. This is called once in each control interval where the condition is true. The change in the signal is measured over the period of the last control interval.
[in] | delta_signal | Change in the signal over the control interval. |
Implemented in geopm::SumAccumulatorImp.