From 2d6427a63cad8056ba6bcaaaa8df21977c8dde3d Mon Sep 17 00:00:00 2001 From: Wangyang Guo Date: Fri, 29 Nov 2024 16:05:35 +0800 Subject: benchtests: Add calloc test Two new benchmarks related to calloc added: - bench-calloc-simple - bench-calloc-thread Reviewed-by: H.J. Lu --- benchtests/bench-malloc-thread.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'benchtests/bench-malloc-thread.c') diff --git a/benchtests/bench-malloc-thread.c b/benchtests/bench-malloc-thread.c index 46fdabd30c..92c41624ea 100644 --- a/benchtests/bench-malloc-thread.c +++ b/benchtests/bench-malloc-thread.c @@ -16,6 +16,11 @@ License along with the GNU C Library; if not, see . */ +#ifndef TEST_FUNC +# define TEST_FUNC(size) malloc(size) +# define TEST_NAME "malloc" +#endif + #include #include #include @@ -137,7 +142,7 @@ malloc_benchmark_loop (void **ptr_arr) free (ptr_arr[next_idx]); - ptr_arr[next_idx] = malloc (next_block); + ptr_arr[next_idx] = TEST_FUNC (next_block); iters++; } @@ -256,7 +261,7 @@ main (int argc, char **argv) json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, "malloc"); + json_attr_object_begin (&json_ctx, TEST_NAME); json_attr_object_begin (&json_ctx, ""); -- cgit v1.2.3