precision

Crates.ioprecision
lib.rsprecision
version0.1.17
sourcesrc
created_at2018-08-21 22:53:47.093714
updated_at2024-03-21 14:06:12.020043
descriptionLow overhead, high precision measurement crate
homepagehttps://github.com/jedisct1/rust-precision
repositoryhttps://github.com/jedisct1/rust-precision
max_upload_size
id80656
size17,409
Frank Denis (jedisct1)

documentation

README

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();
Commit count: 69

cargo fmt