1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

benchtests: Add calloc test

Two new benchmarks related to calloc added:
- bench-calloc-simple
- bench-calloc-thread
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
Wangyang Guo
2024-11-29 16:05:35 +08:00
committed by H.J. Lu
parent 19a198f058
commit 2d6427a63c
5 changed files with 64 additions and 5 deletions

View File

@@ -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 <errno.h>
#include <math.h>
#include <pthread.h>
@@ -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, "");