24#ifndef TVM_RUNTIME_TIMER_H_
25#define TVM_RUNTIME_TIMER_H_
27#include <tvm/ffi/function.h>
77class Timer :
public ffi::ObjectRef {
136 explicit Timer(ffi::UnsafeInit tag, ffi::ObjectPtr<TimerObj> n) : ffi::ObjectRef(tag) {
137 data_ = std::move(n);
191 int min_repeat_ms,
int limit_zero_time_iterations,
192 int cooldown_interval_ms,
int repeats_to_cooldown,
193 int cache_flush_bytes = 0, ffi::Function f_preproc =
nullptr);
Base class for all timer implementations.
Definition timer.h:41
virtual void Stop()=0
Stop the timer.
static constexpr const bool _type_mutable
Definition timer.h:67
TVM_FFI_DECLARE_OBJECT_INFO("runtime.TimerNode", TimerObj, ffi::Object)
virtual int64_t SyncAndGetElapsedNanos()=0
Synchronize timer state and return elapsed time between Start and Stop.
virtual void Start()=0
Start the timer.
virtual ~TimerObj()
Definition timer.h:65
Timer for a specific device.
Definition timer.h:77
Timer(ffi::UnsafeInit tag, ffi::ObjectPtr< TimerObj > n)
Definition timer.h:136
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Timer, ffi::ObjectRef, TimerObj)
static TVM_RUNTIME_DLL Timer Start(Device dev)
Get a device specific timer.
Abstract device memory management API.
ffi::Function WrapTimeEvaluator(ffi::Function f, Device dev, int number, int repeat, int min_repeat_ms, int limit_zero_time_iterations, int cooldown_interval_ms, int repeats_to_cooldown, int cache_flush_bytes=0, ffi::Function f_preproc=nullptr)
Wrap a timer function to measure the time cost of a given packed function.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
DLDevice Device
Definition device_api.h:45
#define TVM_RUNTIME_DLL
Definition base.h:100
Device-independent tensor allocation, copies, views and serialization.