Bitcoin ABC 0.34.3
P2P Digital Currency
Loading...
Searching...
No Matches
util_time.cpp
Go to the documentation of this file.
1// Copyright (c) 2019 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
10 bench.run([&] { (void)GetTime(); });
11}
12
13static void BenchTimeMock(benchmark::Bench &bench) {
14 SetMockTime(111);
15 bench.run([&] { (void)GetTime<std::chrono::seconds>(); });
16 SetMockTime(0);
17}
18
19static void BenchTimeMillis(benchmark::Bench &bench) {
20 bench.run([&] { (void)GetTime<std::chrono::milliseconds>(); });
21}
22
24 bench.run([&] { (void)GetTimeMillis(); });
25}
26
#define BENCHMARK(n)
Definition bench.h:65
Main entry point to nanobench's benchmarking facility.
Definition nanobench.h:616
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition nanobench.h:1183
int64_t GetTimeMillis()
Returns the system time (not mockable)
Definition time.cpp:76
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
Definition time.cpp:80
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
Definition time.cpp:64
static void BenchTimeMock(benchmark::Bench &bench)
Definition util_time.cpp:13
static void BenchTimeDeprecated(benchmark::Bench &bench)
Definition util_time.cpp:9
static void BenchTimeMillis(benchmark::Bench &bench)
Definition util_time.cpp:19
static void BenchTimeMillisSys(benchmark::Bench &bench)
Definition util_time.cpp:23