bench: [refactor] iwyu

This commit is contained in:
MarcoFalke 2024-08-26 17:27:54 +02:00
parent 6d546336e8
commit fab0e834b8
No known key found for this signature in database
48 changed files with 332 additions and 84 deletions

View file

@ -4,12 +4,18 @@
#include <addrman.h>
#include <bench/bench.h>
#include <compat/compat.h>
#include <netaddress.h>
#include <netbase.h>
#include <netgroup.h>
#include <protocol.h>
#include <random.h>
#include <span.h>
#include <uint256.h>
#include <util/check.h>
#include <util/time.h>
#include <cstring>
#include <optional>
#include <vector>

View file

@ -2,11 +2,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <base58.h>
#include <bench/bench.h>
#include <span.h>
#include <array>
#include <cstring>
#include <vector>

View file

@ -2,12 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <bech32.h>
#include <bench/bench.h>
#include <util/strencodings.h>
#include <string>
#include <vector>

View file

@ -4,16 +4,21 @@
#include <bench/bench.h>
#include <test/util/setup_common.h>
#include <test/util/setup_common.h> // IWYU pragma: keep
#include <tinyformat.h>
#include <util/fs.h>
#include <util/string.h>
#include <chrono>
#include <compare>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <ratio>
#include <regex>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>

View file

@ -5,17 +5,18 @@
#ifndef BITCOIN_BENCH_BENCH_H
#define BITCOIN_BENCH_BENCH_H
#include <bench/nanobench.h> // IWYU pragma: export
#include <util/fs.h>
#include <util/macros.h>
#include <chrono>
#include <cstdint>
#include <functional>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <bench/nanobench.h> // IWYU pragma: export
/*
* Usage:

View file

@ -3,15 +3,16 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <clientversion.h>
#include <common/args.h>
#include <crypto/sha256.h>
#include <tinyformat.h>
#include <util/fs.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <exception>
#include <iostream>
#include <sstream>
#include <vector>

View file

@ -3,12 +3,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <key.h>
#include <pubkey.h>
#include <random.h>
#include <span.h>
#include <algorithm>
#include <array>
#include <cstddef>

View file

@ -3,17 +3,21 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <consensus/validation.h>
#include <crypto/sha256.h>
#include <consensus/consensus.h>
#include <node/miner.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/mining.h>
#include <test/util/script.h>
#include <test/util/setup_common.h>
#include <txmempool.h>
#include <validation.h>
#include <array>
#include <cassert>
#include <cstddef>
#include <memory>
#include <vector>
static void AssembleBlock(benchmark::Bench& bench)

View file

@ -4,10 +4,15 @@
#include <bench/bench.h>
#include <coins.h>
#include <consensus/amount.h>
#include <key.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <test/util/transaction_utils.h>
#include <cassert>
#include <vector>
// Microbenchmark for simple accesses to a CCoinsViewCache database. Note from

View file

@ -6,6 +6,11 @@
#include <bench/bench.h>
#include <crypto/chacha20.h>
#include <crypto/chacha20poly1305.h>
#include <span.h>
#include <cstddef>
#include <cstdint>
#include <vector>
/* Number of bytes to process per iteration */
static const uint64_t BUFFER_SIZE_TINY = 64;

View file

@ -4,14 +4,23 @@
#include <bench/bench.h>
#include <bench/data.h>
#include <chainparams.h>
#include <common/args.h>
#include <consensus/validation.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <util/chaintype.h>
#include <validation.h>
#include <cassert>
#include <cstddef>
#include <memory>
#include <optional>
#include <vector>
// These are the two major time-sinks which happen after we have fully received
// a block off the wire, but before we can relay the block on to peers using
// compact block relay.

View file

@ -6,6 +6,8 @@
#include <test/util/setup_common.h>
#include <validation.h>
#include <memory>
static void CheckBlockIndex(benchmark::Bench& bench)
{
auto testing_setup{MakeNoLogFileContext<TestChain100Setup>()};

View file

@ -7,9 +7,11 @@
#include <common/system.h>
#include <key.h>
#include <prevector.h>
#include <pubkey.h>
#include <random.h>
#include <cstddef>
#include <cstdint>
#include <utility>
#include <vector>
static const size_t BATCHES = 101;

View file

@ -3,9 +3,13 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <util/bitset.h>
#include <cluster_linearize.h>
#include <util/bitset.h>
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <vector>
using namespace cluster_linearize;

View file

@ -3,15 +3,28 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <node/context.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <random.h>
#include <sync.h>
#include <util/result.h>
#include <wallet/coinselection.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <wallet/test/util.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
#include <cassert>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>
using node::NodeContext;
using wallet::AttemptSelection;

View file

@ -11,11 +11,14 @@
#include <crypto/sha3.h>
#include <crypto/sha512.h>
#include <crypto/siphash.h>
#include <hash.h>
#include <random.h>
#include <span.h>
#include <tinyformat.h>
#include <uint256.h>
#include <cstdint>
#include <vector>
/* Number of bytes to hash per iteration */
static const uint64_t BUFFER_SIZE = 1000*1000;

View file

@ -4,6 +4,8 @@
#include <bench/data.h>
#include <iterator>
namespace benchmark {
namespace data {

View file

@ -4,11 +4,16 @@
#include <bench/bench.h>
#include <key.h>
#include <pubkey.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <cassert>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
static void ExpandDescriptor(benchmark::Bench& bench)
{

View file

@ -5,9 +5,18 @@
#include <bench/bench.h>
#include <kernel/disconnected_transactions.h>
#include <primitives/block.h>
#include <test/util/random.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <test/util/setup_common.h>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <memory>
#include <vector>
constexpr size_t BLOCK_VTX_COUNT{4000};
constexpr size_t BLOCK_VTX_COUNT_10PERCENT{400};

View file

@ -3,15 +3,28 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <chain.h>
#include <chainparams.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <pow.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <txmempool.h>
#include <uint256.h>
#include <validation.h>
#include <cassert>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
static void DuplicateInputs(benchmark::Bench& bench)
{

View file

@ -3,9 +3,14 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <key.h>
#include <pubkey.h>
#include <random.h>
#include <span.h>
#include <uint256.h>
#include <algorithm>
#include <cassert>
static void EllSwiftCreate(benchmark::Bench& bench)
{

View file

@ -4,6 +4,11 @@
#include <bench/bench.h>
#include <blockfilter.h>
#include <uint256.h>
#include <cstdint>
#include <utility>
#include <vector>
static GCSFilter::ElementSet GenerateGCSTestElements()
{

View file

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <hash.h>
#include <crypto/sha256.h>
#include <random.h>
#include <uint256.h>

View file

@ -2,14 +2,28 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <addresstype.h>
#include <bench/bench.h>
#include <blockfilter.h>
#include <chain.h>
#include <index/base.h>
#include <index/blockfilterindex.h>
#include <node/chainstate.h>
#include <node/context.h>
#include <interfaces/chain.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <pubkey.h>
#include <script/script.h>
#include <span.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <util/time.h>
#include <validation.h>
#include <cassert>
#include <memory>
#include <vector>
// Very simple block filter index sync benchmark, only using coinbase outputs.
static void BlockFilterIndexSync(benchmark::Bench& bench)

View file

@ -5,11 +5,22 @@
#include <bench/bench.h>
#include <bench/data.h>
#include <chainparams.h>
#include <clientversion.h>
#include <flatfile.h>
#include <node/blockstorage.h>
#include <span.h>
#include <streams.h>
#include <test/util/setup_common.h>
#include <util/chaintype.h>
#include <uint256.h>
#include <util/fs.h>
#include <validation.h>
#include <cstdint>
#include <cstdio>
#include <map>
#include <memory>
#include <stdexcept>
#include <vector>
/**
* The LoadExternalBlockFile() function is used during -reindex and -loadblock.
*

View file

@ -3,9 +3,10 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <support/lockedpool.h>
#include <cstddef>
#include <cstdint>
#include <vector>
#define ASIZE 2048

View file

@ -5,7 +5,9 @@
#include <bench/bench.h>
#include <logging.h>
#include <test/util/setup_common.h>
#include <util/chaintype.h>
#include <functional>
#include <vector>
// All but 2 of the benchmarks should have roughly similar performance:
//

View file

@ -3,10 +3,19 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <kernel/mempool_entry.h>
#include <consensus/amount.h>
#include <kernel/cs_main.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <txmempool.h>
#include <util/check.h>
#include <cstdint>
#include <memory>
#include <vector>
static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)

View file

@ -3,16 +3,23 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <kernel/mempool_entry.h>
#include <consensus/amount.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <random.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <txmempool.h>
#include <util/chaintype.h>
#include <validation.h>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
class CCoinsViewCache;
static void AddTx(const CTransactionRef& tx, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)
{
int64_t nTime = 0;

View file

@ -3,11 +3,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <consensus/merkle.h>
#include <random.h>
#include <uint256.h>
#include <vector>
static void MerkleRoot(benchmark::Bench& bench)
{
FastRandomContext rng(true);

View file

@ -3,13 +3,12 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <net.h>
#include <netaddress.h>
#include <node/eviction.h>
#include <random.h>
#include <test/util/net.h>
#include <test/util/setup_common.h>
#include <algorithm>
#include <chrono>
#include <functional>
#include <vector>

View file

@ -5,9 +5,12 @@
#include <bench/bench.h>
#include <crypto/poly1305.h>
#include <span.h>
#include <cstddef>
#include <cstdint>
#include <vector>
/* Number of bytes to process per iteration */
static constexpr uint64_t BUFFER_SIZE_TINY = 64;
static constexpr uint64_t BUFFER_SIZE_SMALL = 256;

View file

@ -5,7 +5,11 @@
#include <bench/bench.h>
#include <support/allocators/pool.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <unordered_map>
#include <utility>
template <typename Map>
void BenchFillClearMap(benchmark::Bench& bench, Map& map)

View file

@ -3,11 +3,13 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <prevector.h>
#include <serialize.h>
#include <streams.h>
#include <type_traits>
#include <bench/bench.h>
#include <serialize.h>
#include <streams.h>
#include <type_traits>
#include <vector>
struct nontrivial_t {
int x{-1};

View file

@ -5,7 +5,9 @@
#include <bench/bench.h>
#include <random.h>
#include <algorithm>
#include <cstdint>
#include <iterator>
#include <numeric>
namespace {

View file

@ -4,14 +4,21 @@
#include <bench/bench.h>
#include <bench/data.h>
#include <consensus/validation.h>
#include <flatfile.h>
#include <node/blockstorage.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <test/util/setup_common.h>
#include <util/chaintype.h>
#include <validation.h>
#include <cassert>
#include <cstdint>
#include <memory>
#include <vector>
static FlatFilePos WriteBlockToDisk(ChainstateManager& chainman)
{
DataStream stream{benchmark::data::block413567};

View file

@ -6,7 +6,9 @@
#include <bench/bench.h>
#include <common/bloom.h>
#include <crypto/common.h>
#include <span.h>
#include <cstdint>
#include <vector>
static void RollingBloom(benchmark::Bench& bench)

View file

@ -4,14 +4,22 @@
#include <bench/bench.h>
#include <bench/data.h>
#include <chain.h>
#include <core_io.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <rpc/blockchain.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
#include <test/util/setup_common.h>
#include <util/chaintype.h>
#include <uint256.h>
#include <univalue.h>
#include <validation.h>
#include <univalue.h>
#include <cstddef>
#include <memory>
#include <vector>
namespace {

View file

@ -3,14 +3,19 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <consensus/amount.h>
#include <kernel/cs_main.h>
#include <kernel/mempool_entry.h>
#include <primitives/transaction.h>
#include <rpc/mempool.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <txmempool.h>
#include <util/chaintype.h>
#include <univalue.h>
#include <util/check.h>
#include <memory>
#include <vector>
static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)

View file

@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <addresstype.h>
#include <bench/bench.h>
#include <coins.h>
#include <key.h>
#include <primitives/transaction.h>
@ -11,10 +11,16 @@
#include <script/interpreter.h>
#include <script/script.h>
#include <script/sign.h>
#include <uint256.h>
#include <script/signingprovider.h>
#include <span.h>
#include <test/util/random.h>
#include <uint256.h>
#include <util/translation.h>
#include <cassert>
#include <map>
#include <vector>
enum class InputType {
P2WPKH, // segwitv0, witness-pubkey-hash (ECDSA signature)
P2TR, // segwitv1, taproot key-path spend (Schnorr signature)

View file

@ -4,8 +4,11 @@
#include <bench/bench.h>
#include <bench/data.h>
#include <span.h>
#include <util/strencodings.h>
#include <vector>
static void HexStrBench(benchmark::Bench& bench)
{
auto const& data = benchmark::data::block413567;

View file

@ -3,13 +3,20 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <hash.h>
#include <key.h>
#include <script/script.h>
#include <primitives/transaction.h>
#include <pubkey.h>
#include <script/interpreter.h>
#include <streams.h>
#include <script/script.h>
#include <span.h>
#include <test/util/transaction_utils.h>
#include <uint256.h>
#include <array>
#include <cassert>
#include <cstdint>
#include <vector>
// Microbenchmark for verification of a basic P2WPKH script. Can be easily
// modified to measure performance of other types of scripts.

View file

@ -4,16 +4,24 @@
#include <bench/bench.h>
#include <interfaces/chain.h>
#include <node/chainstate.h>
#include <node/context.h>
#include <kernel/chainparams.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <sync.h>
#include <test/util/mining.h>
#include <test/util/setup_common.h>
#include <wallet/test/util.h>
#include <validationinterface.h>
#include <uint256.h>
#include <util/time.h>
#include <validation.h>
#include <wallet/receive.h>
#include <wallet/test/util.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
#include <cassert>
#include <memory>
#include <optional>
#include <string>
namespace wallet {
static void WalletBalance(benchmark::Bench& bench, const bool set_dirty, const bool add_mine)

View file

@ -2,14 +2,25 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <bench/bench.h>
#include <node/context.h>
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <random.h>
#include <support/allocators/secure.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/fs.h>
#include <util/translation.h>
#include <wallet/context.h>
#include <wallet/db.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
#include <cassert>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
namespace wallet {
static void WalletCreate(benchmark::Bench& bench, bool encrypted)

View file

@ -2,17 +2,42 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
#include <addresstype.h>
#include <bench/bench.h>
#include <chain.h>
#include <chainparams.h>
#include <wallet/coincontrol.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <interfaces/chain.h>
#include <kernel/chain.h>
#include <node/context.h>
#include <node/blockstorage.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/result.h>
#include <util/time.h>
#include <validation.h>
#include <versionbits.h>
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
#include <wallet/spend.h>
#include <wallet/test/util.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
#include <cassert>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
using wallet::CWallet;
using wallet::CreateMockableWalletDatabase;

View file

@ -2,20 +2,29 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <addresstype.h>
#include <bench/bench.h>
#include <interfaces/chain.h>
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <key.h>
#include <key_io.h>
#include <node/context.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <sync.h>
#include <test/util/setup_common.h>
#include <util/translation.h>
#include <validationinterface.h>
#include <wallet/context.h>
#include <wallet/db.h>
#include <wallet/test/util.h>
#include <wallet/types.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
#include <cassert>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
namespace wallet {
static void WalletIsMine(benchmark::Bench& bench, bool legacy_wallet, int num_combo = 0)
{

View file

@ -2,21 +2,25 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <addresstype.h>
#include <bench/bench.h>
#include <interfaces/chain.h>
#include <node/context.h>
#include <test/util/mining.h>
#include <config/bitcoin-config.h> // IWYU pragma: keep
#include <consensus/amount.h>
#include <outputtype.h>
#include <primitives/transaction.h>
#include <test/util/setup_common.h>
#include <wallet/test/util.h>
#include <util/translation.h>
#include <validationinterface.h>
#include <util/check.h>
#include <wallet/context.h>
#include <wallet/receive.h>
#include <wallet/db.h>
#include <wallet/test/util.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
#include <wallet/walletutil.h>
#include <optional>
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
namespace wallet{
static void AddTx(CWallet& wallet)

View file

@ -3,8 +3,8 @@
// file COPYING or https://opensource.org/license/mit/.
#include <bench/bench.h>
#include <random.h>
#include <span.h>
#include <streams.h>
#include <cstddef>