aboutsummaryrefslogtreecommitdiff
path: root/benchtests/bench-malloc-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests/bench-malloc-simple.c')
-rw-r--r--benchtests/bench-malloc-simple.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/benchtests/bench-malloc-simple.c b/benchtests/bench-malloc-simple.c
index 289bb660ad..2af52ae6b8 100644
--- a/benchtests/bench-malloc-simple.c
+++ b/benchtests/bench-malloc-simple.c
@@ -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>
@@ -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;