6 #include <bench/data/block413567.raw.h> 15 #include <validation.h> 24 DataStream stream{benchmark::data::block413567};
32 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(
ChainType::MAIN)};
33 auto& blockman{testing_setup->m_node.chainman->m_blockman};
36 const auto pos{blockman.WriteBlock(block, 413
'567)}; 37 assert(!pos.IsNull()); 41 static void ReadBlockBench(benchmark::Bench& bench) 43 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(ChainType::MAIN)}; 44 auto& blockman{testing_setup->m_node.chainman->m_blockman}; 45 const auto pos{blockman.WriteBlock(CreateTestBlock(), 413'567)};
48 const auto success{blockman.ReadBlock(block, pos)};
55 const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(
ChainType::MAIN)};
56 auto& blockman{testing_setup->m_node.chainman->m_blockman};
58 std::vector<uint8_t> block_data; 59 blockman.ReadRawBlock(block_data, pos); // warmup 61 const auto success{blockman.ReadRawBlock(block_data, pos)}; 66 BENCHMARK(SaveBlockBench, benchmark::PriorityLevel::HIGH); 67 BENCHMARK(ReadBlockBench, benchmark::PriorityLevel::HIGH); 68 BENCHMARK(ReadRawBlockBench, benchmark::PriorityLevel::HIGH);
static void SaveBlockBench(benchmark::Bench &bench)
static void ReadRawBlockBench(benchmark::Bench &bench)
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Double ended buffer combining vector and stream-like interfaces.
static CBlock CreateTestBlock()
Main entry point to nanobench's benchmarking facility.
static constexpr TransactionSerParams TX_WITH_WITNESS