diff options
Diffstat (limited to 'benchtests/bench-malloc-simple.c')
-rw-r--r-- | benchtests/bench-malloc-simple.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/benchtests/bench-malloc-simple.c b/benchtests/bench-malloc-simple.c index 289bb66..1d7989e 100644 --- a/benchtests/bench-malloc-simple.c +++ b/benchtests/bench-malloc-simple.c @@ -1,5 +1,5 @@ /* Benchmark malloc and free functions. - Copyright (C) 2019-2024 Free Software Foundation, Inc. + Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,6 +16,11 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifndef TEST_FUNC +# define TEST_FUNC(size) malloc(size) +# define TEST_NAME "malloc" +#endif + #include <pthread.h> #include <stdio.h> #include <stdlib.h> @@ -30,7 +35,7 @@ multi-threaded using thread-arena, and main arena with SINGLE_THREAD_P false. */ -#define NUM_ITERS 200000 +#define NUM_ITERS 5000000 #define NUM_ALLOCS 4 #define MAX_ALLOCS 1600 @@ -55,7 +60,7 @@ do_benchmark (malloc_args *args, int **arr) for (int j = 0; j < iters; j++) { for (int i = 0; i < n; i++) - arr[i] = malloc (size); + arr[i] = TEST_FUNC (size); for (int i = 0; i < n; i++) free (arr[i]); @@ -124,7 +129,7 @@ bench (unsigned long size) json_attr_object_begin (&json_ctx, "functions"); - json_attr_object_begin (&json_ctx, "malloc"); + json_attr_object_begin (&json_ctx, TEST_NAME); char s[100]; double iters2 = iters; |