Skip to content

Commit

Permalink
test: Increase resolution of MB/s stat for bench runs close to 1 second
Browse files Browse the repository at this point in the history
MB/s was based on the number of iterations performed in a second, when
the iteration duration nears 1 second (1e9 ns), the resolution of the
MB/s stat decreases.
  • Loading branch information
bluss committed Jan 16, 2016
1 parent 42c3ef8 commit 627829b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libtest/lib.rs
Expand Up @@ -1258,8 +1258,7 @@ pub mod bench {
let ns_iter_summ = bs.auto_bench(f);

let ns_iter = cmp::max(ns_iter_summ.median as u64, 1);
let iter_s = 1_000_000_000 / ns_iter;
let mb_s = (bs.bytes * iter_s) / 1_000_000;
let mb_s = bs.bytes * 1000 / ns_iter;

BenchSamples {
ns_iter_summ: ns_iter_summ,
Expand Down

0 comments on commit 627829b

Please sign in to comment.