aboutsummaryrefslogtreecommitdiff
path: root/src/bench/bench.h
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-11-09 11:48:13 -0500
committerMatt Corallo <git@bluematt.me>2017-11-09 14:36:11 -0500
commit620bae34cfe10e20daa0dcec7e4b9ffee8dfd397 (patch)
tree6963a58641a5777c3f9734a5f7440b268e3ee049 /src/bench/bench.h
parent9e9e31aa10190bcf9136280946e49d893262f7f8 (diff)
downloadbitcoin-620bae34cfe10e20daa0dcec7e4b9ffee8dfd397.tar.xz
Require a steady clock for bench with at least micro precision
Diffstat (limited to 'src/bench/bench.h')
-rw-r--r--src/bench/bench.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bench/bench.h b/src/bench/bench.h
index d276f4ee91..ab5c3d5604 100644
--- a/src/bench/bench.h
+++ b/src/bench/bench.h
@@ -37,13 +37,11 @@ BENCHMARK(CODE_TO_TIME);
*/
namespace benchmark {
- // On many systems, the high_resolution_clock offers no better resolution than the steady_clock.
- // If that's the case, prefer the steady_clock.
+ // In case high_resolution_clock is steady, prefer that, otherwise use steady_clock.
struct best_clock {
using hi_res_clock = std::chrono::high_resolution_clock;
using steady_clock = std::chrono::steady_clock;
- static constexpr bool steady_is_high_res = std::ratio_less_equal<steady_clock::period, hi_res_clock::period>::value;
- using type = std::conditional<steady_is_high_res, steady_clock, hi_res_clock>::type;
+ using type = std::conditional<hi_res_clock::is_steady, hi_res_clock, steady_clock>::type;
};
using clock = best_clock::type;
using time_point = clock::time_point;