Bitcoin Core 28.99.0
P2P Digital Currency
strencodings.cpp
Go to the documentation of this file.
1// Copyright (c) 2022 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 <bench/data/block413567.raw.h>
7#include <span.h>
8#include <util/strencodings.h>
9
10#include <vector>
11
12static void HexStrBench(benchmark::Bench& bench)
13{
14 auto const& data = benchmark::data::block413567;
15 bench.batch(data.size()).unit("byte").run([&] {
16 auto hex = HexStr(data);
18 });
19}
20
BENCHMARK(HexStrBench, benchmark::PriorityLevel::HIGH)
static void HexStrBench(benchmark::Bench &bench)
Main entry point to nanobench's benchmarking facility.
Definition: nanobench.h:627
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition: nanobench.h:1234
Bench & batch(T b) noexcept
Sets the batch size.
Definition: nanobench.h:1258
Bench & unit(char const *unit)
Sets the operation unit.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition: hex_base.cpp:29
void doNotOptimizeAway(Arg &&arg)
Makes sure none of the given arguments are optimized away by the compiler.
Definition: nanobench.h:1279
@ HIGH
Definition: bench.h:48