pub struct CpuTimer { /* private fields */ }Expand description
CPU timer — wall-clock via Instant. There’s no GPU to wait on,
so the “GPU time” is just the CPU work duration.
Implementations§
Trait Implementations§
Source§impl BackendTimer<CpuBackend> for CpuTimer
impl BackendTimer<CpuBackend> for CpuTimer
Source§fn new() -> Self
fn new() -> Self
Allocate timer state. On CUDA this creates two
cuEvent_t
handles; on Metal it’s a no-op; on CPU it’s two Option<Instant>.Source§fn record_start(&mut self, _ctx: &mut <CpuBackend as Backend>::Context)
fn record_start(&mut self, _ctx: &mut <CpuBackend as Backend>::Context)
Record the “start” timestamp on the current ctx’s stream/command
buffer. Returns immediately on CUDA (async); on Metal forces a
sync to flush any pending work first.
Source§fn record_end(&mut self, _ctx: &mut <CpuBackend as Backend>::Context)
fn record_end(&mut self, _ctx: &mut <CpuBackend as Backend>::Context)
Record the “end” timestamp.
Source§fn elapsed_ms(&self) -> f64
fn elapsed_ms(&self) -> f64
Synchronize on the recorded events and return the elapsed time
in milliseconds. Blocks the calling thread on CUDA; instant on CPU/Metal. Read more
Auto Trait Implementations§
impl Freeze for CpuTimer
impl RefUnwindSafe for CpuTimer
impl Send for CpuTimer
impl Sync for CpuTimer
impl Unpin for CpuTimer
impl UnsafeUnpin for CpuTimer
impl UnwindSafe for CpuTimer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more