11 releases

✓ Uses Rust 2018 edition

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

#13 in Profiling

Download history 457/week @ 2020-02-09 415/week @ 2020-02-16 494/week @ 2020-02-23 375/week @ 2020-03-01 432/week @ 2020-03-08 438/week @ 2020-03-15 531/week @ 2020-03-22 492/week @ 2020-03-29 557/week @ 2020-04-05 583/week @ 2020-04-12 839/week @ 2020-04-19 537/week @ 2020-04-26 553/week @ 2020-05-03 703/week @ 2020-05-10 1065/week @ 2020-05-17 626/week @ 2020-05-24

2,206 downloads per month
Used in sightglass

ISC license

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

~165KB