AceCommon  1.4.5
Arduino library for low-level common functions and features with no external dependencies
Public Member Functions | List of all members
ace_common::TimingStats Class Reference

Helper class to collect timing statistics such as min, max, average, and exponential-decay average. More...

#include <TimingStats.h>

Public Member Functions

 TimingStats ()
 Constructor. More...
 
 TimingStats (const TimingStats &)=default
 Default copy constructor.
 
TimingStatsoperator= (const TimingStats &)=default
 Default assignment operator.
 
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(). More...
 
uint16_t getExpDecayAvg () const
 An exponential decay average since the last reset().
 
uint16_t getCount () const
 Number of times update() was called since last reset().
 
uint16_t getCounter () const
 Number of times update() was called from the beginning of time. More...
 
void update (uint16_t duration)
 Add the given duration (often in milliseconds) to the statistics.
 

Detailed Description

Helper class to collect timing statistics such as min, max, average, and exponential-decay average.

Definition at line 36 of file TimingStats.h.

Constructor & Destructor Documentation

◆ TimingStats()

ace_common::TimingStats::TimingStats ( )
inline

Constructor.

Calls reset().

Definition at line 39 of file TimingStats.h.

Member Function Documentation

◆ getAvg()

uint16_t ace_common::TimingStats::getAvg ( ) const
inline

Return the average since the last reset().

Returns 0 if update() has never been called.

Definition at line 74 of file TimingStats.h.

◆ getCounter()

uint16_t ace_common::TimingStats::getCounter ( ) const
inline

Number of times update() was called from the beginning of time.

Never reset. This is useful to determining how many times update() was called since it was last checked from the client code.

Definition at line 87 of file TimingStats.h.


The documentation for this class was generated from the following file: