This class encapsulates a system dependent timer value of type Ticks and provides some simple interface for measuring multiple time spans and providing their sum, average, minimum and maximum.
Definition at line 22 of file stopwatch.hpp.
#include <stopwatch.hpp>
Public Method Index: | |
StopWatch () | |
Ticks::Duration | GetAverage () const |
Ticks::Duration | GetCumulated () const |
Ticks::Duration | GetMaximum () const |
Ticks::Duration | GetMinimum () const |
int | GetSampleCnt () const |
Ticks & | GetStartTime () |
void | Reset () |
Ticks::Duration | Sample () |
void | Start () |
|
protected |
The number of samples performed.
Definition at line 30 of file stopwatch.hpp.
|
protected |
The maximum duration probed.
Definition at line 39 of file stopwatch.hpp.
|
protected |
The minimum duration probed.
Definition at line 36 of file stopwatch.hpp.
|
protected |
The current start time.
Definition at line 27 of file stopwatch.hpp.
|
protected |
The sum of the samples times.
Definition at line 33 of file stopwatch.hpp.
|
inline |
|
inline |
Returns the average time of all samples since this instance was created or reset. If no measurement was performed, the result value will be set to 0
.
Definition at line 134 of file stopwatch.hpp.
|
inline |
Returns the cumulated time of all samples taken since this instance was created or cleared.
Definition at line 123 of file stopwatch.hpp.
|
inline |
Returns the maximum duration of all samples since this instance was created or reset. If no measurement was performed, the value evaluates to the maximum value storable in type Ticks::Duration.
Definition at line 159 of file stopwatch.hpp.
|
inline |
Returns the minimum duration of all samples since this instance was created or reset. If no measurement was performed, the value evaluates to the minmum value storable in type Ticks::Duration.
Definition at line 147 of file stopwatch.hpp.
|
inline |
Returns the number of calls to Sample since this instance was created or Reset was invoked.
Definition at line 112 of file stopwatch.hpp.
|
inline |
Provides access to the internal start time.
Definition at line 56 of file stopwatch.hpp.
|
inline |
Sets the internal value to current system time and clears existing sum and quantity of samples.
Definition at line 75 of file stopwatch.hpp.
|
inline |
Returns the time span between the current system time and the internal start value. In addition this value is added to the sum of sample times and the sample counter is increased by one. Lastly the internal reference value is set to now. Therefore, a subsequent call to this function would measure the time span from this call to this subsequent call (if the internal start time value was not set differently meanwhile).
Definition at line 95 of file stopwatch.hpp.
|
inline |
Sets the start time to now. This affects both, the reference value for the calculation of this StopWatch's age in subsequent calls, as well as subsequent sample time spans.
Definition at line 66 of file stopwatch.hpp.