Add missing correction behaviour to the other types of benchmarks

master
Trivernis 5 years ago
parent 1fb2aecab3
commit 842401043f

@ -1,6 +1,6 @@
[package] [package]
name = "benchlib-rs" name = "benchlib-rs"
version = "0.3.0" version = "0.3.1"
authors = ["Trivernis <trivernis@gmail.com>"] authors = ["Trivernis <trivernis@gmail.com>"]
edition = "2018" edition = "2018"
license-file = "LICENSE" license-file = "LICENSE"

@ -195,7 +195,12 @@ impl Bencher {
for _ in 0..self.iterations { for _ in 0..self.iterations {
let start = Instant::now(); let start = Instant::now();
func(); func();
durations.push(start.elapsed()); let duration = start.elapsed();
if duration > self.bench_duration {
durations.push(duration - self.bench_duration);
} else {
durations.push(duration);
}
} }
} }
println!("Result: {}", durations); println!("Result: {}", durations);

Loading…
Cancel
Save