25 #ifndef ACE_COMMON_TIMING_STATS_H
26 #define ACE_COMMON_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) {
100 mExpDecayAvg = duration;
104 mExpDecayAvg = (mExpDecayAvg/2) + (duration/2)
105 + ((mExpDecayAvg & 0x1) & (duration & 0x1));
113 uint16_t mExpDecayAvg;
Helper class to collect timing statistics such as min, max, average, and exponential-decay average.
TimingStats & operator=(const TimingStats &)=default
Default assignment operator.
uint16_t getMax() const
Return the maximum since the last reset().
uint16_t getMin() const
Return the minium since the last reset().
uint16_t getCount() const
Number of times update() was called since last reset().
TimingStats(const TimingStats &)=default
Default copy constructor.
void update(uint16_t duration)
Add the given duration (often in milliseconds) to the statistics.
TimingStats()
Constructor.
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 getAvg() const
Return the average since the last reset().
uint16_t getExpDecayAvg() const
An exponential decay average since the last reset().