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 23 of file stopwatch.hpp.
#include <stopwatch.hpp>
Public Method Index: | |
StopWatch () | |
Creates a started 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 Field Index: | |
int | cntSamples =0 |
The number of samples performed. | |
Ticks::Duration | max |
The maximum duration probed. | |
Ticks::Duration | min |
The minimum duration probed. | |
Ticks | startTime |
The current start time. | |
Ticks::Duration | sum |
The sum of the samples times. | |
|
protected |
The number of samples performed.
Definition at line 31 of file stopwatch.hpp.
|
protected |
The maximum duration probed.
Definition at line 40 of file stopwatch.hpp.
|
protected |
The minimum duration probed.
Definition at line 37 of file stopwatch.hpp.
|
protected |
The current start time.
Definition at line 28 of file stopwatch.hpp.
|
protected |
The sum of the samples times.
Definition at line 34 of file stopwatch.hpp.
|
inline |
Creates a started StopWatch.
Definition at line 47 of file stopwatch.hpp.
|
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 135 of file stopwatch.hpp.
|
inline |
Returns the cumulated time of all samples taken since this instance was created or cleared.
Definition at line 124 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 160 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 148 of file stopwatch.hpp.
|
inline |
Returns the number of calls to Sample since this instance was created or Reset was invoked.
Definition at line 113 of file stopwatch.hpp.
|
inline |
Provides access to the internal start time.
Definition at line 57 of file stopwatch.hpp.
|
inline |
Sets the internal value to current system time and clears existing sum and quantity of samples.
Definition at line 76 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 96 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 67 of file stopwatch.hpp.