Trait kernel::hil::hw_debug::CycleCounter

source ·
pub trait CycleCounter {
    // Required methods
    fn start(&self);
    fn stop(&self);
    fn count(&self) -> u64;
    fn reset(&self);

    // Provided method
    fn profile_closure<F: FnOnce()>(&self, f: F) -> u64 { ... }
}

Required Methods§

source

fn start(&self)

Enable and start the cycle counter. Depending on the underlying hardware, it may be necessary to call reset before starting the cycle counter for the first time to get accurate results.

source

fn stop(&self)

Stop the cycle counter. Does nothing if the cycle counter is not present.

source

fn count(&self) -> u64

Return the current value of the cycle counter.

source

fn reset(&self)

Reset the counter to zero and stop the cycle counter.

Provided Methods§

source

fn profile_closure<F: FnOnce()>(&self, f: F) -> u64

Benchmark the number of cycles to run a passed closure. This function is intended for use debugging in-kernel routines.

Object Safety§

This trait is not object safe.

Implementors§