diff options
Diffstat (limited to 'benchtests/bench-bzero.c')
-rw-r--r-- | benchtests/bench-bzero.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c index 93ec521725..500b7eba96 100644 --- a/benchtests/bench-bzero.c +++ b/benchtests/bench-bzero.c @@ -17,12 +17,25 @@ <https://www.gnu.org/licenses/>. */ #define TEST_MAIN -#define TEST_NAME "bzero" +#ifdef DO_MEMSET +# define TEST_NAME "memset" +#else +# define TEST_NAME "bzero" +#endif #define MIN_PAGE_SIZE 131072 #include "bench-string.h" #include "json-lib.h" +#ifdef DO_MEMSET +void *generic_memset (void *, int, size_t); + +typedef void *(*proto_t) (void *, int, size_t); + +IMPL (memset, 1) +IMPL (generic_memset, 0) + +#else static void memset_zero (void * s, size_t len) { @@ -33,6 +46,7 @@ typedef void (*proto_t) (void *, size_t); IMPL (bzero, 1) IMPL (memset_zero, 0) +#endif static void do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n) @@ -43,7 +57,11 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n) TIMING_NOW (start); for (i = 0; i < iters; ++i) { +#ifdef DO_MEMSET + CALL (impl, s, 0, n); +#else CALL (impl, s, n); +#endif } TIMING_NOW (stop); @@ -132,3 +150,13 @@ test_main (void) } #include <support/test-driver.c> + +#ifdef DO_MEMSET +# define libc_hidden_builtin_def(X) +# define libc_hidden_def(X) +# define libc_hidden_weak(X) +# define weak_alias(X,Y) +# undef MEMSET +# define MEMSET generic_memset +# include <string/memset.c> +#endif |