diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2017-10-25 16:38:24 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2017-11-07 17:15:58 -0500 |
commit | c515d266ec04d7f0b2b1b3815a793c27ddcd4e1c (patch) | |
tree | 57055da9437118e4220868fee4ce3853534cb7c3 /src/bench/rollingbloom.cpp | |
parent | 57ee73990f1ce29916adfd99f93eae1ccea1a43b (diff) |
bench: switch to std::chrono for time measurements
std::chrono removes portability issues.
Rather than storing doubles, store the untouched time_points. Then
convert to nanoseconds for display. This allows for maximum precision, while
keeping results comparable between differing hardware/operating systems.
Also, display full nanosecond counts rather than sub-second floats.
Diffstat (limited to 'src/bench/rollingbloom.cpp')
-rw-r--r-- | src/bench/rollingbloom.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bench/rollingbloom.cpp b/src/bench/rollingbloom.cpp index 73c02cf718..a93d0fb0a5 100644 --- a/src/bench/rollingbloom.cpp +++ b/src/bench/rollingbloom.cpp @@ -6,7 +6,6 @@ #include "bench.h" #include "bloom.h" -#include "utiltime.h" static void RollingBloom(benchmark::State& state) { @@ -23,10 +22,10 @@ static void RollingBloom(benchmark::State& state) data[2] = count >> 16; data[3] = count >> 24; if (countnow == nEntriesPerGeneration) { - int64_t b = GetTimeMicros(); + auto b = benchmark::clock::now(); filter.insert(data); - int64_t e = GetTimeMicros(); - std::cout << "RollingBloom-refresh,1," << (e-b)*0.000001 << "," << (e-b)*0.000001 << "," << (e-b)*0.000001 << "\n"; + auto total = std::chrono::duration_cast<std::chrono::nanoseconds>(benchmark::clock::now() - b).count(); + std::cout << "RollingBloom-refresh,1," << total << "," << total << "," << total << "\n"; countnow = 0; } else { filter.insert(data); |