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);
Helper class to collect timing statistics such as min, max, average, and exponential-decay average.
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.
T getMin() const
Return the minium since the last reset().
uint16_t getCount() const
Number of times update() was called since last reset().
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.
GenericStats(const GenericStats &)=default
Default copy constructor.
GenericStats()
Constructor.
T getExpDecayAvg() const
An exponential decay average since the last reset().
T getAvg() const
Return the average since the last reset().