diff options
| author | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2016-01-16 17:34:42 +0100 |
|---|---|---|
| committer | Ulrik Sverdrup <bluss@users.noreply.github.com> | 2016-01-16 22:58:00 +0100 |
| commit | 627829bde84cfdb68ba12020ccfd032585f91dda (patch) | |
| tree | 00ea834ad7d5b6da762eb8d81bcf7d7dadee81bc | |
| parent | 42c3ef8f9fd4b0dd1f881c49323bad456163f202 (diff) | |
| download | rust-627829bde84cfdb68ba12020ccfd032585f91dda.tar.gz rust-627829bde84cfdb68ba12020ccfd032585f91dda.zip | |
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.
| -rw-r--r-- | src/libtest/lib.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index a844bdf1351..fb8905072b4 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -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, |
