mirror of
https://github.com/google/benchmark.git
synced 2024-11-25 22:47:20 +00:00
improve walltime test
This commit is contained in:
parent
c0755c4226
commit
21207a4df5
|
@ -5,16 +5,28 @@
|
||||||
#include "../src/walltime.h"
|
#include "../src/walltime.h"
|
||||||
|
|
||||||
void BM_CPUTimeNow(benchmark::State& state) {
|
void BM_CPUTimeNow(benchmark::State& state) {
|
||||||
|
using benchmark::walltime::CPUWalltimeNow;
|
||||||
while (state.KeepRunning()) {
|
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);
|
((void)now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BENCHMARK(BM_CPUTimeNow);
|
BENCHMARK(BM_CPUTimeNow);
|
||||||
|
|
||||||
void BM_ChronoTimeNow(benchmark::State& state) {
|
void BM_ChronoTimeNow(benchmark::State& state) {
|
||||||
|
using benchmark::walltime::ChronoWalltimeNow;
|
||||||
while (state.KeepRunning()) {
|
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);
|
((void)now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue