Class TimerObj#
Defined in File timer.h
Inheritance Relationships#
Base Type#
public ffi::Object
Class Documentation#
-
class TimerObj : public ffi::Object#
Base class for all timer implementations.
New implementations of this interface should make sure that
StartandStopare as lightweight as possible. Expensive state synchronization should be done inSyncAndGetElapsedNanos.Public Functions
-
virtual void Start() = 0#
Start the timer.
Note: this function should only be called once per object.
-
virtual void Stop() = 0#
Stop the timer.
Note: this function should only be called once per object.
-
virtual int64_t SyncAndGetElapsedNanos() = 0#
Synchronize timer state and return elapsed time between
StartandStop.This function is necessary because we want to avoid timing the overhead of doing timing. When using multiple timers, it is recommended to stop all of them before calling
SyncAndGetElapsedNanoson any of them.Note: this function should be only called once per object. It may incur a large synchronization overhead (for example, with GPUs).
-
inline virtual ~TimerObj()#
-
virtual void Start() = 0#