![]() |
AGX Dynamics 2.40.1.3
|
The Timer class permits timing execution speed with the same refinement as the built in hardware clock of the CPU. More...
#include <Timer.h>
Public Member Functions | |
Timer (bool startImmediately=false) | |
Creates a timer. | |
UInt64 | getNumTicks () const |
Report execution time in CPU cycles. | |
UInt64 | getStartTick () const |
Real64 | getTime () const |
Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspended. | |
bool | isRunning () const |
void | reset (bool startAfterReset=false) |
Clear all data. | |
void | start () |
Starts the timer. | |
void | stop () |
Stops the timer. | |
Static Public Member Functions | |
static Real64 | convertToMs (UInt64 ticks) |
static UInt64 | getCurrentTick () |
static Real64 | getTime (UInt64 startTick) |
static void | initClockSpeed () |
For internal use only. | |
The Timer class permits timing execution speed with the same refinement as the built in hardware clock of the CPU.
Profiling tools typically have sampling rates which are too coarse for detailed timing analysis. The Timer class uses the hardware clock to record beginning and end times of given code sections.
A Timer based upon std::chrono::high_resolution_clock is available in agx::HighAccuracyTimer. It has more overhead than agx::Timer, but can provide better accuracy in some cases e.g. virtualized environments where TSC-based measurements might not have full granularity.
|
inline |
Definition at line 251 of file Timer.h.
Referenced by agxUtil::TimerBlock::create(), and getTime().
|
static |
Definition at line 207 of file Timer.h.
References agxAbort1.
Referenced by agxTerrain::ScopeReportSystemJob::ScopeReportSystemJob(), agxTerrain::ScopeReportSystemJob::~ScopeReportSystemJob(), getTime(), start(), stop(), and agxUtil::TimerBlock::stop().
UInt64 agx::Timer::getNumTicks | ( | ) | const |
UInt64 agx::Timer::getStartTick | ( | ) | const |
Real64 agx::Timer::getTime | ( | ) | const |
Report total elapsed time since start in milliseconds, excluding intervals when the timer was suspended.
Definition at line 191 of file Timer.h.
References getCurrentTick().
Referenced by agx::Job::getExecutionTime().
Definition at line 246 of file Timer.h.
References convertToMs(), and getCurrentTick().
|
static |
For internal use only.
bool agx::Timer::isRunning | ( | ) | const |
void agx::Timer::reset | ( | bool | startAfterReset = false | ) |
void agx::Timer::start | ( | ) |
Starts the timer.
Calling start on a already started timer will have no effect.
Definition at line 140 of file Timer.h.
References getCurrentTick().
void agx::Timer::stop | ( | ) |
Stops the timer.
Calling stop on a already stopped timer will have no effect. Upon stopping, the amount of cycles and time ran will be updated.
Definition at line 151 of file Timer.h.
References getCurrentTick().