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