mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-05 20:51:25 +02:00
bench: support benching all verbosity of BlockToJson
This commit is contained in:
@@ -45,17 +45,34 @@ struct TestBlockAndIndex {
|
||||
|
||||
} // namespace
|
||||
|
||||
static void BlockToJsonVerbose(benchmark::Bench& bench)
|
||||
static void BlockToJson(benchmark::Bench& bench, TxVerbosity verbosity)
|
||||
{
|
||||
TestBlockAndIndex data;
|
||||
const uint256 pow_limit{data.testing_setup->m_node.chainman->GetParams().GetConsensus().powLimit};
|
||||
bench.run([&] {
|
||||
auto univalue = blockToJSON(data.testing_setup->m_node.chainman->m_blockman, data.block, data.blockindex, data.blockindex, TxVerbosity::SHOW_DETAILS_AND_PREVOUT, pow_limit);
|
||||
auto univalue = blockToJSON(data.testing_setup->m_node.chainman->m_blockman, data.block, data.blockindex, data.blockindex, verbosity, pow_limit);
|
||||
ankerl::nanobench::doNotOptimizeAway(univalue);
|
||||
});
|
||||
}
|
||||
|
||||
BENCHMARK(BlockToJsonVerbose, benchmark::PriorityLevel::HIGH);
|
||||
static void BlockToJsonVerbosity1(benchmark::Bench& bench)
|
||||
{
|
||||
BlockToJson(bench, TxVerbosity::SHOW_TXID);
|
||||
}
|
||||
|
||||
static void BlockToJsonVerbosity2(benchmark::Bench& bench)
|
||||
{
|
||||
BlockToJson(bench, TxVerbosity::SHOW_DETAILS);
|
||||
}
|
||||
|
||||
static void BlockToJsonVerbosity3(benchmark::Bench& bench)
|
||||
{
|
||||
BlockToJson(bench, TxVerbosity::SHOW_DETAILS_AND_PREVOUT);
|
||||
}
|
||||
|
||||
BENCHMARK(BlockToJsonVerbosity1, benchmark::PriorityLevel::HIGH);
|
||||
BENCHMARK(BlockToJsonVerbosity2, benchmark::PriorityLevel::HIGH);
|
||||
BENCHMARK(BlockToJsonVerbosity3, benchmark::PriorityLevel::HIGH);
|
||||
|
||||
static void BlockToJsonVerboseWrite(benchmark::Bench& bench)
|
||||
{
|
||||
|
Reference in New Issue
Block a user