| Crates.io | precision |
| lib.rs | precision |
| version | 0.1.18 |
| created_at | 2018-08-21 22:53:47.093714+00 |
| updated_at | 2024-12-09 11:57:20.206107+00 |
| 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,637 |
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();