|
From: <sv...@va...> - 2007-10-11 07:11:24
|
Author: njn
Date: 2007-10-11 08:11:24 +0100 (Thu, 11 Oct 2007)
New Revision: 6979
Log:
Add a Massif-specific performance test.
Added:
branches/MASSIF2/massif/perf/
branches/MASSIF2/massif/perf/Makefile.am
branches/MASSIF2/massif/perf/many-xpts.c
branches/MASSIF2/massif/perf/many-xpts.vgperf
Added: branches/MASSIF2/massif/perf/Makefile.am
===================================================================
--- branches/MASSIF2/massif/perf/Makefile.am (rev 0)
+++ branches/MASSIF2/massif/perf/Makefile.am 2007-10-11 07:11:24 UTC (rev 6979)
@@ -0,0 +1,13 @@
+
+# For AM_FLAG_M3264_PRI
+include $(top_srcdir)/Makefile.flags.am
+
+EXTRA_DIST = $(noinst_SCRIPTS) \
+ many-xpts.vgperf
+
+check_PROGRAMS = \
+ many-xpts
+
+AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -O $(AM_FLAG_M3264_PRI)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/include
+AM_CXXFLAGS = $(AM_CFLAGS)
Added: branches/MASSIF2/massif/perf/many-xpts.c
===================================================================
--- branches/MASSIF2/massif/perf/many-xpts.c (rev 0)
+++ branches/MASSIF2/massif/perf/many-xpts.c 2007-10-11 07:11:24 UTC (rev 6979)
@@ -0,0 +1,45 @@
+#include <stdlib.h>
+
+#define nth_bit(x, n) ((x >> n) & 1)
+#define Fn(N, Np1) \
+ void a##N(int x) { if (nth_bit(x, N)) a##Np1(x); else a##Np1(x); }
+
+// This test allocates a lot of heap memory, and every allocation features a
+// different stack trace -- the stack traces are effectively a
+// representation of the number 'i', where each function represents a bit in
+// 'i', and if it's a 1 the first function is called, and if it's a 0 the
+// second function is called.
+
+void a999(int x)
+{
+ malloc(100);
+}
+
+Fn(17, 999)
+Fn(16, 17)
+Fn(15, 16)
+Fn(14, 15)
+Fn(13, 14)
+Fn(12, 13)
+Fn(11, 12)
+Fn(10, 11)
+Fn( 9, 10)
+Fn( 8, 9)
+Fn( 7, 8)
+Fn( 6, 7)
+Fn( 5, 6)
+Fn( 4, 5)
+Fn( 3, 4)
+Fn( 2, 3)
+Fn( 1, 2)
+Fn( 0, 1)
+
+int main(void)
+{
+ int i;
+
+ for (i = 0; i < (1 << 18); i++)
+ a0(i);
+
+ return 0;
+}
Added: branches/MASSIF2/massif/perf/many-xpts.vgperf
===================================================================
--- branches/MASSIF2/massif/perf/many-xpts.vgperf (rev 0)
+++ branches/MASSIF2/massif/perf/many-xpts.vgperf 2007-10-11 07:11:24 UTC (rev 6979)
@@ -0,0 +1,2 @@
+prog: many-xpts
+vgopts: --tool=massif --time-unit=B --depth=100
|