diff options
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/addrman.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/bench/addrman.cpp b/src/bench/addrman.cpp index b7bd8a3261..e1175e44ec 100644 --- a/src/bench/addrman.cpp +++ b/src/bench/addrman.cpp @@ -72,7 +72,7 @@ static void AddrManAdd(benchmark::Bench& bench) { CreateAddresses(); - CAddrMan addrman; + CAddrMan addrman(/* deterministic */ false); bench.run([&] { AddAddressesToAddrMan(addrman); @@ -82,7 +82,7 @@ static void AddrManAdd(benchmark::Bench& bench) static void AddrManSelect(benchmark::Bench& bench) { - CAddrMan addrman; + CAddrMan addrman(/* deterministic */ false); FillAddrMan(addrman); @@ -94,7 +94,7 @@ static void AddrManSelect(benchmark::Bench& bench) static void AddrManGetAddr(benchmark::Bench& bench) { - CAddrMan addrman; + CAddrMan addrman(/* deterministic */ false); FillAddrMan(addrman); @@ -112,10 +112,12 @@ static void AddrManGood(benchmark::Bench& bench) * we want to do the same amount of work in every loop iteration. */ bench.epochs(5).epochIterations(1); + const size_t addrman_count{bench.epochs() * bench.epochIterations()}; - std::vector<CAddrMan> addrmans(bench.epochs() * bench.epochIterations()); - for (auto& addrman : addrmans) { - FillAddrMan(addrman); + std::vector<std::unique_ptr<CAddrMan>> addrmans(addrman_count); + for (size_t i{0}; i < addrman_count; ++i) { + addrmans[i] = std::make_unique<CAddrMan>(/* deterministic */ false); + FillAddrMan(*addrmans[i]); } auto markSomeAsGood = [](CAddrMan& addrman) { @@ -130,7 +132,7 @@ static void AddrManGood(benchmark::Bench& bench) uint64_t i = 0; bench.run([&] { - markSomeAsGood(addrmans.at(i)); + markSomeAsGood(*addrmans.at(i)); ++i; }); } |