Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
bench
strencodings.cpp
Go to the documentation of this file.
1
// Copyright (c) 2022-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 <bench/data/block413567.raw.h>
7
#include <
span.h
>
8
#include <
util/strencodings.h
>
9
10
#include <vector>
11
12
static
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);
17
ankerl::nanobench::doNotOptimizeAway
(hex);
18
});
19
}
20
21
BENCHMARK
(
HexStrBench
);
bench.h
BENCHMARK
#define BENCHMARK(n)
Definition
bench.h:68
HexStrBench
static void HexStrBench(benchmark::Bench &bench)
Definition
strencodings.cpp:12
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
ankerl::nanobench::Bench::batch
Bench & batch(T b) noexcept
Sets the batch size.
Definition
nanobench.h:1258
ankerl::nanobench::Bench::unit
Bench & unit(char const *unit)
Sets the operation unit.
HexStr
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition
hex_base.cpp:30
ankerl::nanobench::doNotOptimizeAway
void doNotOptimizeAway(Arg &&arg)
Makes sure none of the given arguments are optimized away by the compiler.
Definition
nanobench.h:1279
span.h
strencodings.h
Generated on
for Bitcoin Core by
1.17.0