core::arch::x86

Function _rdtsc

1.27.0 · Source
pub unsafe fn _rdtsc() -> u64
Available on x86 and (x86 or x86-64) only.
Expand description

Reads the current value of the processor’s time-stamp counter.

The processor monotonically increments the time-stamp counter MSR every clock cycle and resets it to 0 whenever the processor is reset.

The RDTSC instruction is not a serializing instruction. It does not necessarily wait until all previous instructions have been executed before reading the counter. Similarly, subsequent instructions may begin execution before the read operation is performed.

On processors that support the Intel 64 architecture, the high-order 32 bits of each of RAX and RDX are cleared.

Intel’s documentation