Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
bench
util_time.cpp
Go to the documentation of this file.
1
// Copyright (c) 2019-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
#include <util/time.h>
8
9
static
void
BenchTimeDeprecated
(
benchmark::Bench
& bench)
10
{
11
bench.
run
([&] {
12
(void)
GetTime
();
13
});
14
}
15
16
static
void
BenchTimeMock
(
benchmark::Bench
& bench)
17
{
18
SetMockTime
(111);
19
bench.
run
([&] {
20
(void)
GetTime<std::chrono::seconds>
();
21
});
22
SetMockTime
(0);
23
}
24
25
static
void
BenchTimeMillis
(
benchmark::Bench
& bench)
26
{
27
bench.
run
([&] {
28
(void)
GetTime<std::chrono::milliseconds>
();
29
});
30
}
31
32
static
void
BenchTimeMillisSys
(
benchmark::Bench
& bench)
33
{
34
bench.
run
([&] {
35
(void)
TicksSinceEpoch<std::chrono::milliseconds>
(SystemClock::now());
36
});
37
}
38
39
BENCHMARK
(
BenchTimeDeprecated
);
40
BENCHMARK
(
BenchTimeMillis
);
41
BENCHMARK
(
BenchTimeMillisSys
);
42
BENCHMARK
(
BenchTimeMock
);
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
ankerl::nanobench::Bench::run
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition
nanobench.h:1234
GetTime
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
Definition
time.cpp:81
SetMockTime
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
Definition
time.cpp:44
TicksSinceEpoch
constexpr auto TicksSinceEpoch(Timepoint t)
Definition
time.h:84
BenchTimeMock
static void BenchTimeMock(benchmark::Bench &bench)
Definition
util_time.cpp:16
BenchTimeDeprecated
static void BenchTimeDeprecated(benchmark::Bench &bench)
Definition
util_time.cpp:9
BenchTimeMillis
static void BenchTimeMillis(benchmark::Bench &bench)
Definition
util_time.cpp:25
BenchTimeMillisSys
static void BenchTimeMillisSys(benchmark::Bench &bench)
Definition
util_time.cpp:32
Generated on
for Bitcoin Core by
1.17.0