pub trait PlatformTimer {
// Required methods
fn current_ticks() -> u64;
fn ticks_per_second() -> u64;
fn set_timer(ticks: u64);
}Expand description
Platform timer abstraction trait.
Each architecture provides a zero-sized struct implementing this trait, exposing a common interface for tick counting, frequency queries, and hardware timer programming.
Required Methods§
Sourcefn current_ticks() -> u64
fn current_ticks() -> u64
Read the current hardware tick/cycle counter.
This is a monotonically increasing counter whose frequency is
given by ticks_per_second.
Sourcefn ticks_per_second() -> u64
fn ticks_per_second() -> u64
Return the frequency of the tick counter in Hz.
For x86_64 this is an approximate TSC frequency; for AArch64 the
architectural CNTFRQ_EL0; for RISC-V the timebase frequency.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl PlatformTimer for X86_64Timer
Available on x86-64 only.