19 releases

0.1.18 Dec 9, 2024
0.1.17 Mar 21, 2024
0.1.16 May 23, 2023
0.1.15 Aug 10, 2022
0.1.8 Aug 22, 2018

#61 in Profiling

Download history 66/week @ 2024-09-18 103/week @ 2024-09-25 38/week @ 2024-10-02 37/week @ 2024-10-09 64/week @ 2024-10-16 54/week @ 2024-10-23 54/week @ 2024-10-30 42/week @ 2024-11-06 46/week @ 2024-11-13 53/week @ 2024-11-20 71/week @ 2024-11-27 212/week @ 2024-12-04 134/week @ 2024-12-11 57/week @ 2024-12-18 13/week @ 2024-12-25 14/week @ 2025-01-01

278 downloads per month
Used in 20 crates (2 directly)

ISC license

17KB
375 lines

Precision

Precision is a simple crate to perform measurements using hardware counters.

It is especially useful for performing micro-benchmarks.

API documentation

Example

extern crate precision;

let p = precision::Precision::new(precision::Config::default()).unwrap();

let start = p.now();
let stop = p.now();
let elapsed1 = stop - start;

let start = p.now();
let stop = p.now();
let elapsed2 = stop - start;

let elapsed_total = elapsed1 + elapsed2;
let elapsed_total_secs = elapsed_total.as_secs_f64(&p);
let hw_ticks = elapsed_total.ticks();

Dependencies

~0–570KB
~11K SLoC