precision

Low overhead, high precision measurement crate

10 releases

✓ Uses Rust 2018 edition

0.1.9 Mar 12, 2019
0.1.8 Aug 22, 2018

#28 in Profiling

Download history 55/week @ 2018-11-27 32/week @ 2018-12-04 46/week @ 2018-12-11 59/week @ 2018-12-18 12/week @ 2018-12-25 6/week @ 2019-01-01 31/week @ 2019-01-08 14/week @ 2019-01-15 3/week @ 2019-01-22 3/week @ 2019-01-29 3/week @ 2019-02-05 3/week @ 2019-02-19 28/week @ 2019-02-26 30/week @ 2019-03-05

73 downloads per month

ISC license

10KB
212 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

~312KB