bz2.vgperf \
fbench.vgperf \
ffbench.vgperf \
+ heap.vgperf \
sarp.vgperf
check_PROGRAMS = \
- bigcode bz2 fbench ffbench sarp
+ bigcode bz2 fbench ffbench heap sarp
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -O
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/include
of runtime, particularly on larger programs.
- Weaknesses: Highly artificial.
+heap:
+- Description: Does a lot of heap allocation and deallocation, and has a lot
+ of heap blocks live while doing so.
+- Strengths: Stress test for an important sub-system; bug #105039 showed
+ that inefficiencies in heap allocation can make a big
+ difference to programs that allocate a lot.
+- Weaknesses: Highly artificial -- allocation pattern is not real, and only
+ a few different size allocations are used.
+
sarp:
- Description: Does a lot of stack allocation and deallocation.
- Strengths: Tests for a specific performance bug that existed in 3.1.0 and
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+
+#define NLIVE 1000000
+
+#define NITERS (3*1000*1000)
+
+char* arr[NLIVE];
+
+int main ( void )
+{
+ int i, j, nbytes = 0;
+ printf("initialising\n");
+ for (i = 0; i < NLIVE; i++)
+ arr[i] = NULL;
+
+ printf("running\n");
+ j = -1;
+ for (i = 0; i < NITERS; i++) {
+ j++;
+ if (j == NLIVE) j = 0;
+ if (arr[j])
+ free(arr[j]);
+ arr[j] = malloc(nbytes);
+
+ // Cycle through the sizes 0,8,16,24,32. Zero will get rounded up to
+ // 8, so the 8B bucket will get twice as much traffic.
+ nbytes += 8;
+ if (nbytes > 32)
+ nbytes = 0;
+ }
+
+ for (i = 0; i < NLIVE; i++)
+ if (arr[i])
+ free(arr[i]);
+
+ printf("done\n");
+ return 0;
+}
--- /dev/null
+prog: heap
+tools: none memcheck
# the speedup.
if (not defined $first_tTool{$tool}) {
$first_tTool{$tool} = $tTool;
- print(" -----) ");
+ print(" -----) ");
} else {
my $speedup = 100 - (100 * $tTool / $first_tTool{$tool});
- printf("%5.1f%%) ", $speedup);
+ printf("%5.1f%%) ", $speedup);
}
$num_timings_done++;