diff options
author | Oran Agra <oran@redislabs.com> | 2023-05-01 15:38:08 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2023-05-01 15:38:08 +0300 |
commit | b8beda3cf8e5c8218fbe84539d6b5117b3f909d9 (patch) | |
tree | 66934c98c93ac48f6ca912ad547e651221e525d2 /deps/jemalloc/test/stress/microbench.c | |
parent | d659c734569be4ed32a270bac2527ccf35418c43 (diff) | |
parent | 6d23d3ac3b3f9d13ad2ce99029e69a9ea9f2e517 (diff) | |
download | redis-b8beda3cf8e5c8218fbe84539d6b5117b3f909d9.tar.gz |
Merge commit jemalloc 5.3.0
Diffstat (limited to 'deps/jemalloc/test/stress/microbench.c')
-rw-r--r-- | deps/jemalloc/test/stress/microbench.c | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/deps/jemalloc/test/stress/microbench.c b/deps/jemalloc/test/stress/microbench.c index 988b7938f..062e32fde 100644 --- a/deps/jemalloc/test/stress/microbench.c +++ b/deps/jemalloc/test/stress/microbench.c @@ -1,44 +1,5 @@ #include "test/jemalloc_test.h" - -static inline void -time_func(timedelta_t *timer, uint64_t nwarmup, uint64_t niter, - void (*func)(void)) { - uint64_t i; - - for (i = 0; i < nwarmup; i++) { - func(); - } - timer_start(timer); - for (i = 0; i < niter; i++) { - func(); - } - timer_stop(timer); -} - -void -compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a, - void (*func_a), const char *name_b, void (*func_b)) { - timedelta_t timer_a, timer_b; - char ratio_buf[6]; - void *p; - - p = mallocx(1, 0); - if (p == NULL) { - test_fail("Unexpected mallocx() failure"); - return; - } - - time_func(&timer_a, nwarmup, niter, func_a); - time_func(&timer_b, nwarmup, niter, func_b); - - timer_ratio(&timer_a, &timer_b, ratio_buf, sizeof(ratio_buf)); - malloc_printf("%"FMTu64" iterations, %s=%"FMTu64"us, " - "%s=%"FMTu64"us, ratio=1:%s\n", - niter, name_a, timer_usec(&timer_a), name_b, timer_usec(&timer_b), - ratio_buf); - - dallocx(p, 0); -} +#include "test/bench.h" static void malloc_free(void) { @@ -108,7 +69,7 @@ malloc_mus_free(void) { test_fail("Unexpected malloc() failure"); return; } - malloc_usable_size(p); + TEST_MALLOC_SIZE(p); free(p); } |