diff options
| author | est31 <MTest31@outlook.com> | 2020-09-20 10:12:57 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2020-09-20 10:16:01 +0200 |
| commit | cebbd9fcd35a63569b8fb5c836b5a26089861c41 (patch) | |
| tree | fc658cd5cd9102c38e378a0d436bfb7e74a7d044 /library/test/src | |
| parent | 285fc7d704fcdd7b2a37d475d04d5d955490e000 (diff) | |
| download | rust-cebbd9fcd35a63569b8fb5c836b5a26089861c41.tar.gz rust-cebbd9fcd35a63569b8fb5c836b5a26089861c41.zip | |
Use as_nanos in bench.rs and base.rs
Diffstat (limited to 'library/test/src')
| -rw-r--r-- | library/test/src/bench.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/library/test/src/bench.rs b/library/test/src/bench.rs index e92e5b9829e..b709c763296 100644 --- a/library/test/src/bench.rs +++ b/library/test/src/bench.rs @@ -98,10 +98,6 @@ fn fmt_thousands_sep(mut n: usize, sep: char) -> String { output } -fn ns_from_dur(dur: Duration) -> u64 { - dur.as_secs() * 1_000_000_000 + (dur.subsec_nanos() as u64) -} - fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64 where F: FnMut() -> T, @@ -110,7 +106,7 @@ where for _ in 0..k { black_box(inner()); } - ns_from_dur(start.elapsed()) + start.elapsed().as_nanos() as u64 } pub fn iter<T, F>(inner: &mut F) -> stats::Summary |
