12 releases

0.1.11 Jul 26, 2020
0.1.10 May 12, 2020
0.1.9 Mar 12, 2019
0.1.8 Aug 22, 2018

#11 in Profiling

Download history 457/week @ 2020-06-09 437/week @ 2020-06-16 634/week @ 2020-06-23 489/week @ 2020-06-30 750/week @ 2020-07-07 439/week @ 2020-07-14 444/week @ 2020-07-21 529/week @ 2020-07-28 470/week @ 2020-08-04 146/week @ 2020-08-11 223/week @ 2020-08-18 171/week @ 2020-08-25 91/week @ 2020-09-01 157/week @ 2020-09-08 35/week @ 2020-09-15 103/week @ 2020-09-22

1,453 downloads per month
Used in sightglass

ISC license

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

~175KB