mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
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>
This commit is contained in:
@@ -160,6 +160,10 @@ bench-pthread := \
|
||||
thread_create \
|
||||
# bench-pthread
|
||||
|
||||
bench-resolv := \
|
||||
inet_ntop_ipv4 \
|
||||
# bench-resolv
|
||||
|
||||
LDLIBS-bench-pthread-mutex-lock += -lm
|
||||
LDLIBS-bench-pthread-mutex-trylock += -lm
|
||||
LDLIBS-bench-pthread-spin-lock += -lm
|
||||
@@ -419,6 +423,7 @@ ifeq (${BENCHSET},)
|
||||
bench := \
|
||||
$(bench-math) \
|
||||
$(bench-pthread) \
|
||||
$(bench-resolv) \
|
||||
$(bench-string) \
|
||||
# bench
|
||||
else
|
||||
@@ -457,6 +462,7 @@ ifneq ($(strip ${BENCHSET}),)
|
||||
VALIDBENCHSETNAMES := \
|
||||
bench-math \
|
||||
bench-pthread \
|
||||
bench-resolv \
|
||||
bench-string \
|
||||
calloc-simple \
|
||||
calloc-tcache \
|
||||
|
1003
benchtests/inet_ntop_ipv4-inputs
Normal file
1003
benchtests/inet_ntop_ipv4-inputs
Normal file
File diff suppressed because it is too large
Load Diff
10
benchtests/inet_ntop_ipv4-source.c
Normal file
10
benchtests/inet_ntop_ipv4-source.c
Normal file
@@ -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);
|
||||
}
|
Reference in New Issue
Block a user