21 using Candidates = std::vector<NodeEvictionCandidate>;
25 for (
auto& c : candidates) {
26 candidate_setup_fn(c);
32 auto copy = candidates;
58 if (c.
id >= 130 && c.
id < 240) {
59 c.m_network = NET_ONION;
61 c.m_network = NET_IPV4;
74 if (c.
id >= 90 && c.
id < 160) {
75 c.m_network = NET_ONION;
76 }
else if (c.
id >= 170 && c.
id < 250) {
77 c.m_network = NET_I2P;
79 c.m_network = NET_IPV4;
92 if (c.
id >= 30 && c.
id < 47) {
94 }
else if (c.
id >= 24 && c.
id < 28) {
110 if (c.
id >= 70 && c.
id < 80) {
112 }
else if (c.
id >= 80 && c.
id < 96) {
128 if (c.
id >= 170 && c.
id < 180) {
130 }
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)