Changeset View
Changeset View
Standalone View
Standalone View
src/bench/examples.cpp
// Copyright (c) 2015-2016 The Bitcoin Core developers | // Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <bench/bench.h> | #include <bench/bench.h> | ||||
#include <util/time.h> | #include <util/time.h> | ||||
// Sanity test: this should loop ten times, and | // Sanity test: this should loop ten times, and | ||||
// min/max/average should be close to 100ms. | // min/max/average should be close to 100ms. | ||||
static void Sleep100ms(benchmark::State &state) { | static void Sleep100ms(benchmark::State &state) { | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
MilliSleep(100); | UninterruptibleSleep(std::chrono::milliseconds{100}); | ||||
} | } | ||||
} | } | ||||
BENCHMARK(Sleep100ms, 10); | BENCHMARK(Sleep100ms, 10); | ||||
// Extremely fast-running benchmark: | // Extremely fast-running benchmark: | ||||
#include <cmath> | #include <cmath> | ||||
Show All 11 Lines |