Merge #12079: Improve prioritisetransaction test coverage
[bitcoinplatinum.git] / src / bench / Examples.cpp
blobb68c9cd1564d3f00d8931e53e2a42801a672f961
1 // Copyright (c) 2015-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #include <bench/bench.h>
6 #include <validation.h>
7 #include <utiltime.h>
9 // Sanity test: this should loop ten times, and
10 // min/max/average should be close to 100ms.
11 static void Sleep100ms(benchmark::State& state)
13 while (state.KeepRunning()) {
14 MilliSleep(100);
18 BENCHMARK(Sleep100ms, 10);
20 // Extremely fast-running benchmark:
21 #include <math.h>
23 volatile double sum = 0.0; // volatile, global so not optimized away
25 static void Trig(benchmark::State& state)
27 double d = 0.01;
28 while (state.KeepRunning()) {
29 sum += sin(d);
30 d += 0.000001;
34 BENCHMARK(Trig, 12 * 1000 * 1000);