Skip to main content

Module calibrated

Module calibrated 

Source
Expand description

Calibrated hardware-counter clock — REQ-CLK-003.

The hot path reads a hardware counter (x86_64 rdtsc, aarch64 cntvct_el0) and converts with a multiply-shift — never a division. Calibration (calibrate) is an explicit, fallible cold-path step: it brackets counter reads with a reference monotonic clock and derives a 32.32 fixed-point ns-per-tick factor. If calibration fails or the counter is judged unusable (no invariant-TSC bit, unstable rate), CalibratedClock transparently falls back to Instant (std) / CLOCK_MONOTONIC (libc); Clock::source reports which path actually serves reads.

Structs§

CalibratedClock
Precision clock over a hardware counter, with transparent fallback.
Calibration
A calibrated ns-per-tick conversion factor, held as ns_per_tick + frac/2^32 (a 32.32 fixed point).

Enums§

CalError
Why calibration refused the hardware counter.
CalMethod
How the ns-per-tick factor was derived.

Functions§

calibrate
Derive the ns-per-tick calibration factor.