Bitcoin Core
31.99.0
P2P Digital Currency
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
#include <
test/util/time.h
>
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
NodeClockContext
clock_ctx{111
s
};
19
bench.
run
([&] {
20
(void)GetTime<std::chrono::seconds>();
21
});
22
}
23
24
static
void
BenchTimeMillis
(
benchmark::Bench
& bench)
25
{
26
bench.
run
([&] {
27
(void)GetTime<std::chrono::milliseconds>();
28
});
29
}
30
31
static
void
BenchTimeMillisSys
(
benchmark::Bench
& bench)
32
{
33
bench.
run
([&] {
34
(void)TicksSinceEpoch<std::chrono::milliseconds>(SystemClock::now());
35
});
36
}
37
38
BENCHMARK
(
BenchTimeDeprecated
);
39
BENCHMARK
(
BenchTimeMillis
);
40
BENCHMARK
(
BenchTimeMillisSys
);
41
BENCHMARK
(
BenchTimeMock
);
bench.h
NodeClockContext
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Definition:
time.h:40
ankerl::nanobench::Bench
Main entry point to nanobench's benchmarking facility.
Definition:
nanobench.h:633
ankerl::nanobench::Bench::run
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition:
nanobench.h:1292
test_vectors_musig2_generate.s
tuple s
Definition:
test_vectors_musig2_generate.py:72
time.h
GetTime
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
Definition:
time.cpp:89
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:24
BenchTimeMillisSys
static void BenchTimeMillisSys(benchmark::Bench &bench)
Definition:
util_time.cpp:31
BENCHMARK
BENCHMARK(BenchTimeDeprecated)
Generated on Fri Apr 24 2026 20:00:27 for Bitcoin Core by
1.9.4