pub struct Tsc(/* private fields */);Expand description
The x86_64 timestamp counter (TSC).
Note that not all TSC implementations have a constant frequency.
On Linux, try_new_linux_sys checks that the frequency is constant.
Implementations§
Source§impl Tsc
impl Tsc
Sourcepub fn try_new_assume_stable() -> Result<Self, TscUnavailable>
pub fn try_new_assume_stable() -> Result<Self, TscUnavailable>
Returns Ok(Tsc) if the CPUID TSC flag is set.
The TSC flag indicates the counter exists but does not guarantee stability
across cores or CPU power states. Prefer Tsc::try_new_linux_sys on Linux.
Sourcepub fn try_new_linux_sys() -> Result<Self, TscUnavailable>
pub fn try_new_linux_sys() -> Result<Self, TscUnavailable>
Returns Ok(Tsc) if the Linux kernel reports tsc as an available clocksource.
A TSC listed as an available clocksource means the kernel has verified stability across cores and power state changes, making it safe for benchmarking.
Trait Implementations§
Source§impl Clock for Tsc
impl Clock for Tsc
type Time = WrappingU64Time
type Calibration = U64Calibration
Source§fn now(&self) -> WrappingU64Instant
fn now(&self) -> WrappingU64Instant
Returns the current instant.
impl Copy for Tsc
impl Eq for Tsc
impl StructuralPartialEq for Tsc
Auto Trait Implementations§
impl Freeze for Tsc
impl RefUnwindSafe for Tsc
impl Send for Tsc
impl Sync for Tsc
impl Unpin for Tsc
impl UnsafeUnpin for Tsc
impl UnwindSafe for Tsc
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