- x86_64: executes RDTSC CPU instruction to read the time-stamp counter.
- AArch64: reads value of the CNTVCT_EL0 counter-timer register.
The brief description: https://sheroz.com/pages/blog/rust-tick-counter.html
x86_64 (Intel® Core™ i7)
AArch64 (Apple M1 Pro)
For usage samples please look at src/bin/sample.rs
let start = tick_counter::start();
// ... lines of code to benchmark
let elapsed_ticks = tick_counter::stop() - start;
println!("Number of elapsed ticks: {}", elapsed_ticks);
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);
println!("Environment: {}/{} {}", consts::OS, consts::FAMILY, consts::ARCH);
let (counter_frequency, accuracy) = tick_counter::frequency();
let frequency_base = match accuracy {
tick_counter::TickCounterFrequencyBase::Hardware => "hardware provided".to_string(),
tick_counter::TickCounterFrequencyBase::Measured(duration) => format!(