Crates.io | precision |
lib.rs | precision |
version | 0.1.17 |
source | src |
created_at | 2018-08-21 22:53:47.093714 |
updated_at | 2024-03-21 14:06:12.020043 |
description | Low overhead, high precision measurement crate |
homepage | https://github.com/jedisct1/rust-precision |
repository | https://github.com/jedisct1/rust-precision |
max_upload_size | |
id | 80656 |
size | 17,409 |
Precision is a simple crate to perform measurements using hardware counters.
It is especially useful for performing micro-benchmarks.
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();