Expand description
§Hardware-based tick counters for high-precision benchmarks
x86_64
- executes RDTSC CPU instruction to read the time-stamp counter.AArch64
- reads value of the CNTVCT_EL0 counter-timer register.
§Basic usage
let start = tick_counter::start();
// ... lines of code to benchmark
let elapsed_ticks = tick_counter::stop() - start;
println!("Number of elapsed ticks: {}", elapsed_ticks);
§Basic usage with helper
use tick_counter::TickCounter;
let tick_counter = TickCounter::current();
// ... lines of code to benchmark
let elapsed_ticks = tick_counter.elapsed();
println!("Number of elapsed ticks: {}", elapsed_ticks);
Structs§
- Tick
Counter - TickCounter helper
Enums§
- Tick
Counter Frequency Base - The origin of the provided counter frequency
Functions§
- frequency
- Returns a frequency of tick counter in hertz (Hz)
- precision_
nanoseconds - Returns a precision of tick counters in nanoseconds
- start
- Returns a current value of the tick counter to use as a staring point
- stop
- Returns a current value of the tick counter to use as a stopping point
- x86_
64_ measure_ frequency - Returns a measured value of tick counter frequency on
x86_64
architecture in hertz (Hz) - x86_
64_ processor_ id - Returns a tick counter and CPUID values based on Intel CPU’s
RDTSCP
instruction - x86_
64_ tick_ counter - Returns a current value of the tick counter based on Intel CPU’s
RDTSC
instruction