mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 13:13:43 +08:00
Add malloc micro benchmark
Add a malloc micro benchmark to enable accurate testing of the various paths in malloc and free. The benchmark does a varying number of allocations of a given block size, then frees them again. It tests 3 different scenarios: single-threaded using main arena, multi-threaded using thread-arena, main arena with SINGLE_THREAD_P false. * benchtests/Makefile: Add malloc-simple benchmark. * benchtests/bench-malloc-simple.c: New benchmark.
This commit is contained in:
parent
24ca04febe
commit
3904fd85d3
@ -1,3 +1,8 @@
|
|||||||
|
2019-02-14 Wilco Dijkstra <wdijkstr@arm.com>
|
||||||
|
|
||||||
|
* benchtests/Makefile: Add malloc-simple benchmark.
|
||||||
|
* benchtests/bench-malloc-simple.c: New benchmark.
|
||||||
|
|
||||||
2019-02-14 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
2019-02-14 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
|
||||||
* benchtests/bench-memmove.c (do_one_test): Remove unused
|
* benchtests/bench-memmove.c (do_one_test): Remove unused
|
||||||
|
@ -90,7 +90,7 @@ CFLAGS-bench-trunc.c += -fno-builtin
|
|||||||
CFLAGS-bench-truncf.c += -fno-builtin
|
CFLAGS-bench-truncf.c += -fno-builtin
|
||||||
|
|
||||||
ifeq (${BENCHSET},)
|
ifeq (${BENCHSET},)
|
||||||
bench-malloc := malloc-thread
|
bench-malloc := malloc-thread malloc-simple
|
||||||
else
|
else
|
||||||
bench-malloc := $(filter malloc-%,${BENCHSET})
|
bench-malloc := $(filter malloc-%,${BENCHSET})
|
||||||
endif
|
endif
|
||||||
@ -98,7 +98,7 @@ endif
|
|||||||
$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
|
$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
|
||||||
$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
|
$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
|
||||||
$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
|
$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
|
||||||
$(objpfx)bench-malloc-thread: $(shared-thread-library)
|
$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ bench-clean:
|
|||||||
ifneq ($(strip ${BENCHSET}),)
|
ifneq ($(strip ${BENCHSET}),)
|
||||||
VALIDBENCHSETNAMES := bench-pthread bench-math bench-string string-benchset \
|
VALIDBENCHSETNAMES := bench-pthread bench-math bench-string string-benchset \
|
||||||
wcsmbs-benchset stdlib-benchset stdio-common-benchset math-benchset \
|
wcsmbs-benchset stdlib-benchset stdio-common-benchset math-benchset \
|
||||||
malloc-thread
|
malloc-thread malloc-simple
|
||||||
INVALIDBENCHSETNAMES := $(filter-out ${VALIDBENCHSETNAMES},${BENCHSET})
|
INVALIDBENCHSETNAMES := $(filter-out ${VALIDBENCHSETNAMES},${BENCHSET})
|
||||||
ifneq (${INVALIDBENCHSETNAMES},)
|
ifneq (${INVALIDBENCHSETNAMES},)
|
||||||
$(info The following values in BENCHSET are invalid: ${INVALIDBENCHSETNAMES})
|
$(info The following values in BENCHSET are invalid: ${INVALIDBENCHSETNAMES})
|
||||||
@ -200,10 +200,18 @@ bench-set: $(binaries-benchset)
|
|||||||
|
|
||||||
bench-malloc: $(binaries-bench-malloc)
|
bench-malloc: $(binaries-bench-malloc)
|
||||||
for run in $^; do \
|
for run in $^; do \
|
||||||
|
echo "$${run}"; \
|
||||||
|
if [ `basename $${run}` = "bench-malloc-thread" ]; then \
|
||||||
for thr in 1 8 16 32; do \
|
for thr in 1 8 16 32; do \
|
||||||
echo "Running $${run} $${thr}"; \
|
echo "Running $${run} $${thr}"; \
|
||||||
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
||||||
done;\
|
done;\
|
||||||
|
else \
|
||||||
|
for thr in 8 16 32 64 128 256 512 1024 2048 4096; do \
|
||||||
|
echo "Running $${run} $${thr}"; \
|
||||||
|
$(run-bench) $${thr} > $${run}-$${thr}.out; \
|
||||||
|
done;\
|
||||||
|
fi;\
|
||||||
done
|
done
|
||||||
|
|
||||||
# Build and execute the benchmark functions. This target generates JSON
|
# Build and execute the benchmark functions. This target generates JSON
|
||||||
|
Loading…
Reference in New Issue
Block a user