28 auto randAddr = [&rng]() {
45 for (
size_t source_i = 0; source_i <
NUM_SOURCES; ++source_i) {
56 for (
size_t source_i = 0; source_i <
NUM_SOURCES; ++source_i) {
89 const auto& address = addrman.
Select();
90 assert(address.GetPort() > 0);
101 const auto& addresses = addrman.
GetAddr(2500, 23);
102 assert(addresses.size() > 0);
116 for (
auto& addrman : addrmans) {
120 auto markSomeAsGood = [](
CAddrMan& addrman) {
121 for (
size_t source_i = 0; source_i <
NUM_SOURCES; ++source_i) {
123 if (addr_i % 32 == 0) {
132 markSomeAsGood(addrmans.at(i));
static constexpr size_t NUM_SOURCES
Bench & epochIterations(uint64_t numIters) noexcept
Sets exactly the number of iterations for each epoch.
CAddrInfo Select(bool newOnly=false)
Choose an address to connect to.
static constexpr size_t NUM_ADDRESSES_PER_SOURCE
static void AddrManAdd(benchmark::Bench &bench)
bool Add(const CAddress &addr, const CNetAddr &source, int64_t nTimePenalty=0)
Add a single address.
static std::vector< CAddress > g_sources
Stochastical (IP) address manager.
static void AddAddressesToAddrMan(CAddrMan &addrman)
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
A combination of a network address (CNetAddr) and a (TCP) port.
static void FillAddrMan(CAddrMan &addrman)
A CService with information about it as peer.
static std::vector< std::vector< CAddress > > g_addresses
void * memcpy(void *a, const void *b, size_t c)
Bench & epochs(size_t numEpochs) noexcept
Controls number of epochs, the number of measurements to perform.
int64_t GetAdjustedTime()
static void AddrManGetAddr(benchmark::Bench &bench)
std::vector< CAddress > GetAddr(size_t max_addresses, size_t max_pct)
Return a bunch of addresses, selected at random.
static void AddrManSelect(benchmark::Bench &bench)
Main entry point to nanobench's benchmarking facility.
static void CreateAddresses()
static void AddrManGood(benchmark::Bench &bench)
std::vector< unsigned char > randbytes(size_t len)
Generate random bytes.