AceCommon
1.4.6
Arduino library for low-level common functions and features with no external dependencies
|
25 #ifndef ACE_COMMON_GENERIC_STATS_H
26 #define ACE_COMMON_GENERIC_STATS_H
30 namespace ace_common {
82 T
getAvg()
const {
return (mCount > 0) ? mSum / mCount : 0; }
100 if (mCount == 0 || value < mMin) {
103 if (mCount == 0 || value > mMax) {
108 mExpDecayAvg = value;
110 mExpDecayAvg = (mExpDecayAvg/2) + (value/2);
void reset()
Reset the object to its initial state, except mCounter which is never reset.
void update(T value)
Add the given value to the statistics.
GenericStats & operator=(const GenericStats &)=default
Default assignment operator.
uint16_t getCount() const
Number of times update() was called since last reset().
T getAvg() const
Return the average since the last reset().
T getExpDecayAvg() const
An exponential decay average since the last reset().
Helper class to collect timing statistics such as min, max, average, and exponential-decay average.
T getMin() const
Return the minium since the last reset().
GenericStats()
Constructor.
T getMax() const
Return the maximum since the last reset().
uint16_t getCounter() const
Number of times update() was called from the beginning of time.