aboutsummaryrefslogtreecommitdiff
path: root/benchtests/inet_ntop_ipv4-source.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-06-04 17:42:40 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-06-24 09:43:02 -0300
commite6ad9650fbed02f167a90cd6554a7599356317cc (patch)
tree5daccbca973be3eac04269e993b5abbb621f6d62 /benchtests/inet_ntop_ipv4-source.c
parentfc6f074e0496fb8a8df491641165f4ed3cdaa3a3 (diff)
downloadglibc-e6ad9650fbed02f167a90cd6554a7599356317cc.zip
glibc-e6ad9650fbed02f167a90cd6554a7599356317cc.tar.gz
glibc-e6ad9650fbed02f167a90cd6554a7599356317cc.tar.bz2
benchtests: Add IPv4 inet_ntop benchmark
Random IP addresses in the full range. Reviewed-by: Collin Funk <collin.funk1@gmail.com> Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'benchtests/inet_ntop_ipv4-source.c')
-rw-r--r--benchtests/inet_ntop_ipv4-source.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/benchtests/inet_ntop_ipv4-source.c b/benchtests/inet_ntop_ipv4-source.c
new file mode 100644
index 0000000..c595c47
--- /dev/null
+++ b/benchtests/inet_ntop_ipv4-source.c
@@ -0,0 +1,10 @@
+#include <arpa/inet.h>
+#include <stdint.h>
+
+static void
+inet_ntop_ipv4 (uint32_t addr)
+{
+ struct in_addr saddr = { .s_addr = addr };
+ char dst[INET_ADDRSTRLEN];
+ inet_ntop (AF_INET, &saddr, dst, sizeof dst);
+}