Base class for all timer implementations.
New implementations of this interface should make sure that Start and Stop are as lightweight as possible. Expensive state synchronization should be done in SyncAndGetElapsedNanos.
| virtual int64_t tvm::runtime::TimerObj::SyncAndGetElapsedNanos |
( |
| ) |
|
|
pure virtual |
Synchronize timer state and return elapsed time between Start and Stop.
- Returns
- The time in nanoseconds between
Start and Stop.
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 SyncAndGetElapsedNanos on any of them.
Note: this function should be only called once per object. It may incur a large synchronization overhead (for example, with GPUs).