20 using Candidates = std::vector<NodeEvictionCandidate>;
24 for (
auto& c : candidates) {
25 candidate_setup_fn(c);
31 auto copy = candidates;
57 if (c.
id >= 130 && c.
id < 240) {
58 c.m_network = NET_ONION;
60 c.m_network = NET_IPV4;
73 if (c.
id >= 90 && c.
id < 160) {
74 c.m_network = NET_ONION;
75 }
else if (c.
id >= 170 && c.
id < 250) {
76 c.m_network = NET_I2P;
78 c.m_network = NET_IPV4;
91 if (c.
id >= 30 && c.
id < 47) {
93 }
else if (c.
id >= 24 && c.
id < 28) {
109 if (c.
id >= 70 && c.
id < 80) {
111 }
else if (c.
id >= 80 && c.
id < 96) {
127 if (c.
id >= 170 && c.
id < 180) {
129 }
else if (c.
id >= 190 && c.
id < 240) {
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
void ProtectEvictionCandidatesByRatio(std::vector< NodeEvictionCandidate > &eviction_candidates)
Protect desirable or disadvantaged inbound peers from eviction by ratio.
@ NET_ONION
TOR (v2 or v3)
static void EvictionProtection2Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtection3Networks100Candidates(benchmark::Bench &bench)
static void EvictionProtectionCommon(benchmark::Bench &bench, int num_candidates, std::function< void(NodeEvictionCandidate &)> candidate_setup_fn)
static void EvictionProtection1Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtection3Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtection0Networks250Candidates(benchmark::Bench &bench)
static void EvictionProtection3Networks050Candidates(benchmark::Bench &bench)
BENCHMARK(EvictionProtection0Networks250Candidates, benchmark::PriorityLevel::HIGH)
std::chrono::seconds m_connected
std::vector< NodeEvictionCandidate > GetRandomNodeEvictionCandidates(int n_candidates, FastRandomContext &random_context)