https://github.com/jedisct1/rust-precision
Low overhead, high precision measurement crate for Rust
https://github.com/jedisct1/rust-precision
benchmarking rust
Last synced: over 1 year ago
JSON representation
Low overhead, high precision measurement crate for Rust
- Host: GitHub
- URL: https://github.com/jedisct1/rust-precision
- Owner: jedisct1
- License: bsd-2-clause
- Created: 2018-08-21T21:04:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T04:27:19.000Z (over 1 year ago)
- Last Synced: 2025-03-27T00:11:08.207Z (over 1 year ago)
- Topics: benchmarking, rust
- Language: Rust
- Size: 52.7 KB
- Stars: 16
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Precision
Precision is a simple crate to perform measurements using hardware counters.
It is especially useful for performing micro-benchmarks.
## [API documentation](https://docs.rs/precision)
## Example
```rust
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();
```