|
AGX Dynamics
2.37.2.0
|
The HighAccurayTimer class can replace the regular Timer class in high level applications where the need for accuracy is greater than performance. More...
#include <HighAccuracyTimer.h>
Public Member Functions | |
| HighAccuracyTimer (bool startImmediately=false) | |
| Creates a HighAccuracyTimer. More... | |
| UInt64 | getNumTicks () const |
| Report execution time in CPU cycles. More... | |
| UInt64 | getStartTick () const |
| Return the start tick. More... | |
| Real64 | getTime () const |
| Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspended. More... | |
| bool | isRunning () const |
| Return true if running. More... | |
| void | reset (bool startAfterReset=false) |
| Clear all data. More... | |
| void | start () |
| Starts the HighAccuracyTimer. More... | |
| void | stop () |
| Stops the HighAccuracyTimer. More... | |
Static Public Member Functions | |
| static Real64 | convertToMs (UInt64 ticks) |
| Return the given number of ticks in ms. More... | |
| static UInt64 | getCurrentTick () |
| Return raw value of the TSC register (in Windows: QueryPerformanceTimer). More... | |
| static void | initClockSpeed () |
| For internal use only. More... | |
The HighAccurayTimer class can replace the regular Timer class in high level applications where the need for accuracy is greater than performance.
This timer should ONLY be used with low calling frequency, such as when measuring total computation time, where the regular timer accuracy can fall short on certain platforms (Windows).
As of now, this HighAccuracyTimer has identical accuracy and performance for MAC and Linux as the regular Timer class. (For Windows, QueryPerformanceFrequency/QueryPerformanceTimer is used).
Definition at line 63 of file HighAccuracyTimer.h.
|
inline |
Creates a HighAccuracyTimer.
| startImmediately | Should the HighAccuracyTimer start immediately or start in stopped mode (now, but also after consequent calls to reset())? |
Definition at line 140 of file HighAccuracyTimer.h.
Return the given number of ticks in ms.
Definition at line 288 of file HighAccuracyTimer.h.
|
static |
Return raw value of the TSC register (in Windows: QueryPerformanceTimer).
Definition at line 240 of file HighAccuracyTimer.h.
References agxAbort1.
| UInt64 agx::HighAccuracyTimer::getNumTicks | ( | ) | const |
Report execution time in CPU cycles.
Definition at line 191 of file HighAccuracyTimer.h.
| UInt64 agx::HighAccuracyTimer::getStartTick | ( | ) | const |
Return the start tick.
Definition at line 197 of file HighAccuracyTimer.h.
| Real64 agx::HighAccuracyTimer::getTime | ( | ) | const |
Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspended.
Definition at line 209 of file HighAccuracyTimer.h.
References AGX_FORCE_INLINE, and agxAssert1.
|
static |
For internal use only.
| bool agx::HighAccuracyTimer::isRunning | ( | ) | const |
Return true if running.
Definition at line 203 of file HighAccuracyTimer.h.
| void agx::HighAccuracyTimer::reset | ( | bool | startAfterReset = false | ) |
Clear all data.
Definition at line 180 of file HighAccuracyTimer.h.
| void agx::HighAccuracyTimer::start | ( | ) |
Starts the HighAccuracyTimer.
Calling start on a already started HighAccuracyTimer will have no effect.
Definition at line 148 of file HighAccuracyTimer.h.
| void agx::HighAccuracyTimer::stop | ( | ) |
Stops the HighAccuracyTimer.
Calling stop on a already stopped HighAccuracyTimer will have no effect. Upon stopping, the amount of cycles and time ran will be updated.
Definition at line 163 of file HighAccuracyTimer.h.