mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Benchmark operator delete
Added the microbenchmark for operator delete. Also modified bench.h so that it can be used in C++.
This commit is contained in:
@@ -23,7 +23,7 @@ fmt_nsecs(uint64_t usec, uint64_t iters, char *buf) {
|
||||
uint64_t nsecs_per_iter1000 = nsec1000 / iters;
|
||||
uint64_t intpart = nsecs_per_iter1000 / 1000;
|
||||
uint64_t fracpart = nsecs_per_iter1000 % 1000;
|
||||
malloc_snprintf(buf, FMT_NSECS_BUF_SIZE, "%"FMTu64".%03"FMTu64, intpart,
|
||||
malloc_snprintf(buf, FMT_NSECS_BUF_SIZE, "%" FMTu64 ".%03" FMTu64, intpart,
|
||||
fracpart);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
|
||||
return;
|
||||
}
|
||||
|
||||
time_func(&timer_a, nwarmup, niter, func_a);
|
||||
time_func(&timer_b, nwarmup, niter, func_b);
|
||||
time_func(&timer_a, nwarmup, niter, (void (*)())func_a);
|
||||
time_func(&timer_b, nwarmup, niter, (void (*)())func_b);
|
||||
|
||||
uint64_t usec_a = timer_usec(&timer_a);
|
||||
char buf_a[FMT_NSECS_BUF_SIZE];
|
||||
@@ -52,8 +52,8 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
|
||||
fmt_nsecs(usec_b, niter, buf_b);
|
||||
|
||||
timer_ratio(&timer_a, &timer_b, ratio_buf, sizeof(ratio_buf));
|
||||
malloc_printf("%"FMTu64" iterations, %s=%"FMTu64"us (%s ns/iter), "
|
||||
"%s=%"FMTu64"us (%s ns/iter), time consumption ratio=%s:1\n",
|
||||
malloc_printf("%" FMTu64 " iterations, %s=%" FMTu64 "us (%s ns/iter), "
|
||||
"%s=%" FMTu64 "us (%s ns/iter), time consumption ratio=%s:1\n",
|
||||
niter, name_a, usec_a, buf_a, name_b, usec_b, buf_b, ratio_buf);
|
||||
|
||||
dallocx(p, 0);
|
||||
|
||||
@@ -88,7 +88,8 @@ static const bool config_debug =
|
||||
* public jemalloc interfaces with jet_ prefixes, so that stress tests can use
|
||||
* a separate allocator for their internal data structures.
|
||||
*/
|
||||
#elif defined(JEMALLOC_STRESS_TEST)
|
||||
#elif defined(JEMALLOC_STRESS_TEST) || \
|
||||
defined(JEMALLOC_STRESS_CPP_TEST)
|
||||
# include "jemalloc/jemalloc@install_suffix@.h"
|
||||
|
||||
# include "jemalloc/jemalloc_protos_jet.h"
|
||||
|
||||
Reference in New Issue
Block a user