18 releases

0.1.17 Mar 21, 2024
0.1.16 May 23, 2023
0.1.15 Aug 10, 2022
0.1.14 Jan 19, 2022
0.1.8 Aug 22, 2018

#75 in Profiling

Download history 29/week @ 2024-07-01 50/week @ 2024-07-08 120/week @ 2024-07-15 31/week @ 2024-07-22 117/week @ 2024-07-29 57/week @ 2024-08-05 85/week @ 2024-08-12 48/week @ 2024-08-19 115/week @ 2024-08-26 64/week @ 2024-09-02 57/week @ 2024-09-09 45/week @ 2024-09-16 133/week @ 2024-09-23 40/week @ 2024-09-30 25/week @ 2024-10-07 41/week @ 2024-10-14

240 downloads per month
Used in 19 crates (2 directly)

ISC license

16KB
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–560KB
~10K SLoC