A class for measuring execution times. More...
#include <CLUtils.hpp>
Public Member Functions | |
CPUTimer (int initVal=0) | |
Constructs a timer. More... | |
void | start (bool tReset=true) |
Starts the timer. More... | |
rep | stop () |
Stops the timer. More... | |
rep | duration () |
Returns the time measured by the timer. More... | |
void | reset () |
Resets the timer. | |
A class for measuring execution times.
CPUTimer is an interface for std::chrono::duration
.
rep | the type of the value returned by duration . |
period | the unit of time for the value returned by duration . It is declared as an std::ratio<std::intmax_t num, std::intmax_t den> . |
|
inline |
Constructs a timer.
The timer doesn't start automatically.
[in] | initVal | a value to initialize the timer with. |
|
inline |
Returns the time measured by the timer.
This time is measured up to the point the timer last time stopped.
period
units.
|
inline |
Starts the timer.
[in] | tReset | a flag for resetting the timer before the timer starts. If false , the timer starts counting from the point it reached the last time it stopped. |
|
inline |
Stops the timer.
period
units.