MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / FindByte

Function FindByte

src/bench/streams_findbyte.cpp:16–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <memory>
15
16static void FindByte(benchmark::Bench& bench)
17{
18 const auto testing_setup{MakeNoLogFileContext<const BasicTestingSetup>(ChainType::REGTEST)};
19 AutoFile file{fsbridge::fopen(testing_setup->m_path_root / "streams_tmp", "w+b")};
20 const size_t file_size = 200;
21 uint8_t data[file_size] = {0};
22 data[file_size - 1] = 1;
23 file << data;
24 file.seek(0, SEEK_SET);
25 BufferedFile bf{file, /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size};
26
27 bench.setup([&] { bf.SetPos(0); })
28 .run([&] { bf.FindByte(std::byte(1)); });
29
30 assert(file.fclose() == 0);
31}
32
33BENCHMARK(FindByte);

Callers

nothing calls this directly

Calls 7

fopenFunction · 0.85
SetPosMethod · 0.80
FindByteMethod · 0.80
fcloseMethod · 0.80
seekMethod · 0.45
runMethod · 0.45
setupMethod · 0.45

Tested by

no test coverage detected