| public |
Inheritance Graph
graph BT
Timer
click Timer "classUtil_1_1Timer"
Description
High resolution timer.
Class to measure time intervals. The implementation tries to uses a system timer with high resolution. The system timer that is used depends on the platform.
Note: Usage example for measuring a single time interval:
Timer timer;
timer.reset();
doSomething();
timer.stop();
std::cout << "doSomething() took " << timer.getSeconds() << " s." << std::endl;
Note: Usage example for measuring multiple time intervals:
Timer timer;
timer.reset();
timer.stop();
[...]
timer.resume();
doPartA();
timer.stop();
[...]
timer.resume();
doPartB();
timer.stop();
std::cout << "doPartA() and doPartB() took " << timer.getSeconds() << " s." << std::endl;
Public Static Functions
| double | now() Returns the seconds elapsed since program start. |
Public Functions
| Timer() | |
| void | reset() |
| void | stop() |
| void | resume() |
| bool | isRunning() const |
| double | getSeconds() const |
| double | getMilliseconds() const |
| double | getMicroseconds() const |
| uint64_t | getNanoseconds() const |
| bool | operator==(const Timer & other) const |
Documentation
function
Util::Timer::now
| public | static |
| double now( | ) |
Returns the seconds elapsed since program start.
Defined in Util/Timer.h:61
function
Util::Timer::Timer
| public |
| Timer( | ) |
Defined in Util/Timer.h:64
function
Util::Timer::reset
| public |
| void reset( | ) |
Reset the timer to the current time. The timer will be running after the call.
Defined in Util/Timer.h:69
function
Util::Timer::stop
| public |
| void stop( | ) |
Stop the timer. The current time will be stored to be able to resume later on.
Defined in Util/Timer.h:74
function
Util::Timer::resume
| public |
| void resume( | ) |
Start the timer again. This will resume the duration from the point that* stop() *was called last.
Defined in Util/Timer.h:79
function
Util::Timer::isRunning
| public | const | inline |
| bool isRunning( | ) const |
Returns
trueiff the timer is currently running
Defined in Util/Timer.h:84
function
Util::Timer::getSeconds
| public | const | inline |
| double getSeconds( | ) const |
Return the current time.
Returns
Time in seconds
Defined in Util/Timer.h:93
function
Util::Timer::getMilliseconds
| public | const | inline |
| double getMilliseconds( | ) const |
Return the current time.
Returns
Time in milliseconds (1 s = 1e3 ms)
Defined in Util/Timer.h:101
function
Util::Timer::getMicroseconds
| public | const | inline |
| double getMicroseconds( | ) const |
Return the current time.
Returns
Time in microseconds (1 s = 1e6 µs)
Defined in Util/Timer.h:110
function
Util::Timer::getNanoseconds
| public | const |
| uint64_t getNanoseconds( | ) const |
Return the current time.
Returns
Time in nanoseconds (1 s = 1e9 ns)
Defined in Util/Timer.h:118
function
Util::Timer::operator==
| public | const | inline |
| bool operator==( | const Timer & | other ) const |
Defined in Util/Timer.h:120