mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 19:39:02 +02:00
bench: put addrman check ratio in a variable
So that it is easy to modify through the file `bench/addrman.cpp`.
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
static constexpr size_t NUM_SOURCES = 64;
|
||||
static constexpr size_t NUM_ADDRESSES_PER_SOURCE = 256;
|
||||
|
||||
static const std::vector<bool> EMPTY_ASMAP;
|
||||
static constexpr uint32_t ADDRMAN_CONSISTENCY_CHECK_RATIO{0};
|
||||
|
||||
static std::vector<CAddress> g_sources;
|
||||
static std::vector<std::vector<CAddress>> g_addresses;
|
||||
|
||||
@@ -74,14 +77,14 @@ static void AddrManAdd(benchmark::Bench& bench)
|
||||
CreateAddresses();
|
||||
|
||||
bench.run([&] {
|
||||
AddrMan addrman{/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0};
|
||||
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
|
||||
AddAddressesToAddrMan(addrman);
|
||||
});
|
||||
}
|
||||
|
||||
static void AddrManSelect(benchmark::Bench& bench)
|
||||
{
|
||||
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
|
||||
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
|
||||
|
||||
FillAddrMan(addrman);
|
||||
|
||||
@@ -93,7 +96,7 @@ static void AddrManSelect(benchmark::Bench& bench)
|
||||
|
||||
static void AddrManGetAddr(benchmark::Bench& bench)
|
||||
{
|
||||
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
|
||||
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
|
||||
|
||||
FillAddrMan(addrman);
|
||||
|
||||
@@ -122,7 +125,7 @@ static void AddrManAddThenGood(benchmark::Bench& bench)
|
||||
//
|
||||
// This has some overhead (exactly the result of AddrManAdd benchmark), but that overhead is constant so improvements in
|
||||
// AddrMan::Good() will still be noticeable.
|
||||
AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
|
||||
AddrMan addrman{EMPTY_ASMAP, /*deterministic=*/false, ADDRMAN_CONSISTENCY_CHECK_RATIO};
|
||||
AddAddressesToAddrMan(addrman);
|
||||
|
||||
markSomeAsGood(addrman);
|
||||
|
Reference in New Issue
Block a user