13 releases

0.1.12 Oct 19, 2021
0.1.11 Jul 26, 2020
0.1.10 May 12, 2020
0.1.9 Mar 12, 2019
0.1.8 Aug 22, 2018

#41 in Profiling

Download history 21/week @ 2021-08-11 3/week @ 2021-08-18 104/week @ 2021-08-25 12/week @ 2021-09-01 4/week @ 2021-09-08 19/week @ 2021-09-15 8/week @ 2021-09-22 21/week @ 2021-09-29 29/week @ 2021-10-06 63/week @ 2021-10-13 18/week @ 2021-10-20 9/week @ 2021-10-27 33/week @ 2021-11-03 2/week @ 2021-11-10 10/week @ 2021-11-17 8/week @ 2021-11-24

53 downloads per month
Used in 5 crates (2 directly)

ISC license

13KB
288 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();

lib.rs:

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

It is especially useful for performing micro-benchmarks.

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

~245KB