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

 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

Enums

Functions