Skip to content

Commit 627829b

Browse files
committed
test: Increase resolution of MB/s stat for bench runs close to 1 second
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.
1 parent 42c3ef8 commit 627829b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/libtest/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1258,8 +1258,7 @@ pub mod bench {
12581258
let ns_iter_summ = bs.auto_bench(f);
12591259

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

12641263
BenchSamples {
12651264
ns_iter_summ: ns_iter_summ,

0 commit comments

Comments
 (0)