Changeset View
Changeset View
Standalone View
Standalone View
src/bench/block_assemble.cpp
// Copyright (c) 2011-2017 The Bitcoin Core developers | // Copyright (c) 2011-2017 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <bench/bench.h> | #include <bench/bench.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <test/util/mining.h> | #include <test/util/mining.h> | ||||
#include <test/util/setup_common.h> | #include <test/util/setup_common.h> | ||||
#include <test/util/wallet.h> | #include <test/util/wallet.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <vector> | #include <vector> | ||||
static void AssembleBlock(benchmark::State &state) { | static void AssembleBlock(benchmark::Bench &bench) { | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
TestingSetup test_setup{ | TestingSetup test_setup{ | ||||
CBaseChainParams::REGTEST, | CBaseChainParams::REGTEST, | ||||
/* extra_args */ | /* extra_args */ | ||||
{ | { | ||||
"-nodebuglogfile", | "-nodebuglogfile", | ||||
"-nodebug", | "-nodebug", | ||||
}, | }, | ||||
Show All 30 Lines | for (size_t b = 0; b < NUM_BLOCKS; ++b) { | ||||
bool ret{::AcceptToMemoryPool(config, *test_setup.m_node.mempool, | bool ret{::AcceptToMemoryPool(config, *test_setup.m_node.mempool, | ||||
vstate, txr, | vstate, txr, | ||||
false /* bypass_limits */, | false /* bypass_limits */, | ||||
/* nAbsurdFee */ Amount::zero())}; | /* nAbsurdFee */ Amount::zero())}; | ||||
assert(ret); | assert(ret); | ||||
} | } | ||||
} | } | ||||
while (state.KeepRunning()) { | bench.run([&] { PrepareBlock(config, test_setup.m_node, SCRIPT_PUB); }); | ||||
PrepareBlock(config, test_setup.m_node, SCRIPT_PUB); | |||||
} | |||||
} | } | ||||
BENCHMARK(AssembleBlock, 700); | BENCHMARK(AssembleBlock); |