Skip to content
API REFERENCEUsage guides →

cellpack::prof::Clock ​

struct

Module contract · All interfaces

At a glance ​

pub struct Clock { /* private fields */ }

Run-time clock for profiled runs: the TSC where it is invariant, else nanoseconds since the run started. Readings are converted to time once, when the run reports.

Member index ​

3 of 3 members

  • newA clock started now: the TSC where the CPU has an invariant one, else Instant .
  • nowA nonzero reading: the TSC or nanoseconds since the clock started, the low bit always set so zero can mean “no stamp”.
  • nanos_per_tickNanoseconds per tick, measured over the clock’s life so far.

Methods and associated constants ​

new ​

pub fn new() -> Self

A clock started now: the TSC where the CPU has an invariant one, else Instant.

now ​

pub fn now(&self) -> u64

A nonzero reading: the TSC or nanoseconds since the clock started, the low bit always set so zero can mean “no stamp”.

nanos_per_tick ​

pub fn nanos_per_tick(&self) -> f64

Nanoseconds per tick, measured over the clock’s life so far.

Implemented traits ​

impl Clone for Clock
impl Debug for Clock
impl Default for Clock

Contract reference ​

See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.

Definition