tsc-time-0.1.0 doesn't have any documentation.
Time-stamp counter (TSC) timer
This library provides a time-stamp counter (TSC) based timer for micro benchmarking.
Example
#
# extern crate test;
# use black_box;
# use *;
// The function we want to time:
// Non-invariant TSCs might produce unreliable results:
assert!;
let =
span;
assert_eq!;
println!;
// On my machine prints: "Reference cycle count: 951 cycles."
Notes
-
The TSC runs at a different frequency than the CPU clock frequency, so the cycles reported here are "reference cycles" and not real CPU clock cycles.
-
If the TSC is not invariant (Nehalem-and-later) the measurements might not be very accurate due to turbo boost, speed-step, power management, etc.
-
Converting "reference cycles" to time (e.g., nanoseconds) is, in general, not possible to do reliably in user-space.
-
One might want to disable preemption and hard interrupts before timing (see How to Benchmark Code Execution Times on IntelĀ® IA-32 and IA-64 Instruction Set Architectures) to further improve the accuracy of the measurements.