9 #include <test/util/net.h> 10 #include <test/util/setup_common.h> 21 using Candidates = std::vector<NodeEvictionCandidate>;
25 Candidates candidates{GetRandomNodeEvictionCandidates(num_candidates, random_context)};
26 for (
auto& c : candidates) {
27 candidate_setup_fn(c);
30 std::vector<Candidates> copies{
60 if (c.
id >= 130 && c.
id < 240) {
61 c.m_network = NET_ONION;
63 c.m_network = NET_IPV4;
76 if (c.
id >= 90 && c.
id < 160) {
77 c.m_network = NET_ONION;
78 }
else if (c.
id >= 170 && c.
id < 250) {
79 c.m_network = NET_I2P;
81 c.m_network = NET_IPV4;
94 if (c.
id >= 30 && c.
id < 47) {
96 }
else if (c.
id >= 24 && c.
id < 28) {
112 if (c.
id >= 70 && c.
id < 80) {
114 }
else if (c.
id >= 80 && c.
id < 96) {
130 if (c.
id >= 170 && c.
id < 180) {
132 }
else if (c.
id >= 190 && c.
id < 240) {
static void EvictionProtection2Networks250Candidates(benchmark::Bench &bench)
Bench & epochIterations(uint64_t numIters) noexcept
Sets exactly the number of iterations for each epoch.
Bench & warmup(uint64_t numWarmupIters) noexcept
Sets a number of iterations that are initially performed without any measurements.
BENCHMARK(EvictionProtection0Networks250Candidates)
static void EvictionProtection3Networks100Candidates(benchmark::Bench &bench)
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
static void EvictionProtection1Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtection0Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtectionCommon(benchmark::Bench &bench, int num_candidates, std::function< void(NodeEvictionCandidate &)> candidate_setup_fn)
static void EvictionProtection3Networks050Candidates(benchmark::Bench &bench)
Bench & epochs(size_t numEpochs) noexcept
Controls number of epochs, the number of measurements to perform.
Main entry point to nanobench's benchmarking facility.
void ProtectEvictionCandidatesByRatio(std::vector< NodeEvictionCandidate > &eviction_candidates)
Protect desirable or disadvantaged inbound peers from eviction by ratio.
static void EvictionProtection3Networks250Candidates(benchmark::Bench &bench)