Crate tick_counter
source ·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
use tick_counter::*;
let start = tick_counter_start();
// ... lines of code to benchmark
let elapsed_ticks = tick_counter_stop() - start;
println!("Number of elapsed ticks: {}", elapsed_ticks);Enums
- Enum for determining the base of the privided counter frequency
Functions
- Returns frequency of tick counter in HZ.
- Returns a precision of tick counters in nanoseconds
- Returns a current value of the tick counter to use as a staring point
- Returns a current value of the tick counter to use as a stopping point
- Returns a measured value of tick counter frequency on
x86_64architecture - Returns a current value of the tick counter based on Intel CPU’s
RDTSCinstruction - Returns a tick counter and CPUID values based on Intel CPU’s
RDTSCPinstruction