mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 23:03:06 +03:00
Rollup merge of #30959 - bluss:bench-resolution, r=Gankro
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.
This commit is contained in:
+1
-2
@@ -1275,8 +1275,7 @@ pub fn benchmark<F>(f: F) -> BenchSamples where F: FnMut(&mut Bencher) {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user