benchtests: Add IPv6 inet_ntop benchmark

Random IP addresses in the full range.  There is no extra workload
to check the effectiveness '::' optimization for a set of 0-oct
sets (although it would be a possible workload).
Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
Adhemerval Zanella 2025-06-04 17:42:41 -03:00
parent e6ad9650fb
commit 14ca258cc5
3 changed files with 1014 additions and 0 deletions

View File

@ -162,6 +162,7 @@ bench-pthread := \
bench-resolv := \
inet_ntop_ipv4 \
inet_ntop_ipv6 \
# bench-resolv
LDLIBS-bench-pthread-mutex-lock += -lm

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
#include <arpa/inet.h>
#include <stdint.h>
static void
inet_ntop_ipv6 (uint32_t addr1, uint32_t addr2, uint32_t addr3, uint32_t addr4)
{
struct in6_addr saddr = { .s6_addr32 = { addr1, addr2, addr3, addr4 } };
char dst[INET6_ADDRSTRLEN];
inet_ntop (AF_INET6, &saddr, dst, sizeof dst);
}