A timer object to measure elapsed time. More...
#include <Timer.hpp>
Public Member Functions | |
TimeDuration | elapsed () const |
UINT32 | elapsedMicroseconds () const |
Returns the elapsed time in microseconds since the timer was started or restarted. More... | |
UINT32 | elapsedMicrosecondsSinceLastCall () |
Elapsed us since the last call of this function. More... | |
UINT32 | elapsedMilliseconds () const |
Returns the elapsed time in milliseconds since the timer was started or restarted. More... | |
UINT32 | elapsedMillisecondsSinceLastCall () |
Elapsed ms since the last call of this function. More... | |
bool | isElapsed () |
void | reset () |
void | restart () |
Restarts the timer. More... | |
void | startWatchdog (TimeDuration watchdogTime) |
Timer () | |
Constructor. More... | |
virtual | ~Timer () |
Destructor. More... | |
Private Attributes | |
Time | m_startTime |
TimeDuration | m_watchdogTime |
A timer object to measure elapsed time.
This class is intended for simple timing diagnostics during debug phase. For a more accurate profiling of your code use a profiler like valgrind or similar.
Due to accuracy differences on various platforms for Windows PCs and Linux PCs implementations and accuracy may differ.
Timer::Timer | ( | ) |
TimeDuration Timer::elapsed | ( | ) | const |
UINT32 Timer::elapsedMicroseconds | ( | ) | const |
UINT32 Timer::elapsedMicrosecondsSinceLastCall | ( | ) |
UINT32 Timer::elapsedMilliseconds | ( | ) | const |
UINT32 Timer::elapsedMillisecondsSinceLastCall | ( | ) |
Elapsed ms since the last call of this function.
Elapsed time since last call to this function, in [ms]. This function may be called without restarts as it measures the time between consecutive calls to this function. Usage:
t; // ... t.elapsedMillisecondsSinceLastCall(); // ... functions to be timed ... UINT32 time1 = t.elapsedMillisecondsSinceLastCall(); // ... next functions to be timed ... UINT32 time2 = t.elapsedMillisecondsSinceLastCall(); // ...
Thats it!
void Timer::startWatchdog | ( | TimeDuration | watchdogTime | ) |
|
private |