Bitcoin Core  0.20.99
P2P Digital Currency
examples.cpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2020 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.
4 
5 #include <bench/bench.h>
6 
7 // Extremely fast-running benchmark:
8 #include <math.h>
9 
10 volatile double sum = 0.0; // volatile, global so not optimized away
11 
12 static void Trig(benchmark::Bench& bench)
13 {
14  double d = 0.01;
15  bench.run([&] {
16  sum += sin(d);
17  d += 0.000001;
18  });
19 }
20 
volatile double sum
Definition: examples.cpp:10
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition: nanobench.h:1134
static void Trig(benchmark::Bench &bench)
Definition: examples.cpp:12
BENCHMARK(Trig)
Main entry point to nanobench&#39;s benchmarking facility.
Definition: nanobench.h:583