From 21207a4df5ae471f46ef52598c701dd927e6e5b3 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 26 Mar 2015 15:25:08 -0400 Subject: [PATCH] improve walltime test --- test/walltime_test.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/walltime_test.cc b/test/walltime_test.cc index b34c7b30..18c432b6 100644 --- a/test/walltime_test.cc +++ b/test/walltime_test.cc @@ -5,16 +5,28 @@ #include "../src/walltime.h" void BM_CPUTimeNow(benchmark::State& state) { + using benchmark::walltime::CPUWalltimeNow; while (state.KeepRunning()) { - benchmark::WallTime volatile now = benchmark::walltime::CPUWalltimeNow(); + benchmark::WallTime volatile now; + now = CPUWalltimeNow(); + now = CPUWalltimeNow(); + now = CPUWalltimeNow(); + now = CPUWalltimeNow(); + now = CPUWalltimeNow(); ((void)now); } } BENCHMARK(BM_CPUTimeNow); void BM_ChronoTimeNow(benchmark::State& state) { + using benchmark::walltime::ChronoWalltimeNow; while (state.KeepRunning()) { - benchmark::WallTime volatile now = benchmark::walltime::ChronoWalltimeNow(); + benchmark::WallTime volatile now; + now = ChronoWalltimeNow(); + now = ChronoWalltimeNow(); + now = ChronoWalltimeNow(); + now = ChronoWalltimeNow(); + now = ChronoWalltimeNow(); ((void)now); } }