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

#74 in Profiling

Download history 32/week @ 2024-01-01 73/week @ 2024-01-08 50/week @ 2024-01-15 29/week @ 2024-01-22 35/week @ 2024-01-29 67/week @ 2024-02-05 61/week @ 2024-02-12 39/week @ 2024-02-19 125/week @ 2024-02-26 98/week @ 2024-03-04 155/week @ 2024-03-11 248/week @ 2024-03-18 84/week @ 2024-03-25 100/week @ 2024-04-01 45/week @ 2024-04-08 108/week @ 2024-04-15

353 downloads per month
Used in 18 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