Bitcoin Core
31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
src
bench
examples.cpp
Go to the documentation of this file.
1
// Copyright (c) 2015-present 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 <cmath>
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
=
sum
+
sin
(d);
17
d += 0.000001;
18
});
19
}
20
21
BENCHMARK
(
Trig
);
bench.h
BENCHMARK
#define BENCHMARK(n)
Definition
bench.h:68
ankerl::nanobench::Bench
Main entry point to nanobench's benchmarking facility.
Definition
nanobench.h:627
Trig
static void Trig(benchmark::Bench &bench)
Definition
examples.cpp:12
sum
volatile double sum
Definition
examples.cpp:10
Ticks
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition
time.h:73
Generated on Thu Apr 16 2026 09:42:38 for Bitcoin Core by
1.10.0