diff options
author | Wangyang Guo <wangyang.guo@intel.com> | 2024-11-29 16:05:35 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-11-29 19:04:28 +0800 |
commit | 2d6427a63cad8056ba6bcaaaa8df21977c8dde3d (patch) | |
tree | 0af48fd8aa244a5193202a5ebe59e58a1e0e1f37 /benchtests/bench-malloc-thread.c | |
parent | 19a198f05802fcc05441c364ed75311ef3f6d663 (diff) | |
download | glibc-2d6427a63cad8056ba6bcaaaa8df21977c8dde3d.zip glibc-2d6427a63cad8056ba6bcaaaa8df21977c8dde3d.tar.gz glibc-2d6427a63cad8056ba6bcaaaa8df21977c8dde3d.tar.bz2 |
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>
Diffstat (limited to 'benchtests/bench-malloc-thread.c')
-rw-r--r-- | benchtests/bench-malloc-thread.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/benchtests/bench-malloc-thread.c b/benchtests/bench-malloc-thread.c index 46fdabd..92c4162 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 <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, ""); |