Skip to main content

cu29_clock/raw_counter/
x86_64_rdtsc.rs

1// Source: x86-64 time-stamp counter (`RDTSC`).
2// Guarantee: fast cycle-like counter on Copper's supported x86-64 hosts. This
3// assumes an invariant, synchronized TSC; older or unusual systems can violate
4// that across cores or power states.
5pub fn initialize() {}
6
7#[inline(always)]
8pub fn read_raw_counter() -> u64 {
9    // SAFETY: RDTSC is a side-effect-free instruction on x86_64.
10    unsafe { core::arch::x86_64::_rdtsc() }
11}