MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / BenchGetMappedAS

Function BenchGetMappedAS

src/bench/asmap.cpp:18–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include <string>
17
18static void BenchGetMappedAS(benchmark::Bench& bench, std::span<const CNetAddr> addrs, bool check = true)
19{
20 std::span<const std::byte> asmap{node::data::ip_asn};
21 assert(!asmap.empty() && CheckStandardAsmap(asmap));
22 auto netgroupman{NetGroupManager::WithEmbeddedAsmap(asmap)};
23
24 bench.batch(addrs.size()).run([&] {
25 for (const CNetAddr& addr : addrs) {
26 // The embedded ASMap file might change over time and cause some
27 // addresses to become unmapped. We check the mapping to ensure
28 // the addresses are actually mapped.
29 assert((netgroupman.GetMappedAS(addr) > 0) == check);
30 }
31 });
32}
33
34static CNetAddr LookupAddr(const std::string& address) { return LookupHost(address, /*fAllowLookup=*/false).value(); }
35

Callers 9

ASMapGetMappedASQuad9v4Function · 0.85
ASMapGetMappedASQuad9v6Function · 0.85
ASMapGetMappedASGooglev4Function · 0.85
ASMapGetMappedASGooglev6Function · 0.85
ASMapGetMappedASMultiFunction · 0.85

Calls 6

CheckStandardAsmapFunction · 0.85
emptyMethod · 0.45
runMethod · 0.45
batchMethod · 0.45
sizeMethod · 0.45
GetMappedASMethod · 0.45

Tested by

no test coverage detected