6 #include <bench/data/block413567.raw.h> 15 #include <validation.h> 31 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(
ChainType::MAIN)};
32 auto& blockman{testing_setup->m_node.chainman->m_blockman};
35 const auto pos{blockman.WriteBlock(block, 413
'567)}; 36 assert(!pos.IsNull()); 40 static void ReadBlockBench(benchmark::Bench& bench) 42 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(ChainType::MAIN)}; 43 auto& blockman{testing_setup->m_node.chainman->m_blockman}; 44 const auto& test_block{CreateTestBlock()}; 45 const auto& expected_hash{test_block.GetHash()}; 46 const auto& pos{blockman.WriteBlock(test_block, 413'567)};
49 const auto success{blockman.ReadBlock(block, pos, expected_hash)};
56 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(
ChainType::MAIN)};
57 auto& blockman{testing_setup->m_node.chainman->m_blockman};
60 const auto res{blockman.ReadRawBlock(pos)}; 65 BENCHMARK(WriteBlockBench); 66 BENCHMARK(ReadBlockBench); 67 BENCHMARK(ReadRawBlockBench);
static void ReadRawBlockBench(benchmark::Bench &bench)
Minimal stream for reading from an existing byte array by std::span.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
static void WriteBlockBench(benchmark::Bench &bench)
static CBlock CreateTestBlock()
Main entry point to nanobench's benchmarking facility.
static constexpr TransactionSerParams TX_WITH_WITNESS