mirror of git://sourceware.org/git/glibc.git
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:
parent
fc6f074e04
commit
e6ad9650fb
|
@ -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 \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue