|
From: <sv...@va...> - 2006-09-12 21:24:26
|
Author: weidendo
Date: 2006-09-12 22:24:24 +0100 (Tue, 12 Sep 2006)
New Revision: 6058
Log:
Callgrind: Extend test for client requests
This checks all of callgrinds client requests,
and accordings actions (zero/dump) in different states
(collection on/off, instrumentation on/off).
Modified:
trunk/callgrind/tests/clreq.c
Modified: trunk/callgrind/tests/clreq.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/callgrind/tests/clreq.c 2006-09-12 21:13:11 UTC (rev 6057)
+++ trunk/callgrind/tests/clreq.c 2006-09-12 21:24:24 UTC (rev 6058)
@@ -4,10 +4,64 @@
=20
#include "../callgrind.h"
=20
-int main(void)
+int some_work(int sum)
{
+ int i;
+
+ for(i=3D0;i<10;i++) sum +=3D i; /* some dummy work */
+
+ return sum;
+}
+
+int some_callgrind_clreqs()
+{
+ int sum =3D some_work(0);
+
CALLGRIND_ZERO_STATS;
=20
+ sum +=3D some_work(sum);
+
+ CALLGRIND_DUMP_STATS;
+
+ sum +=3D some_work(sum);
+
+ CALLGRIND_DUMP_STATS_AT("Please dump here");
+
+ return some_work(sum);
+}
+
+int more_callgrind_clreqs()
+{
+ int sum =3D some_callgrind_clreqs();
+
+ CALLGRIND_TOGGLE_COLLECT;
+
+ sum +=3D some_callgrind_clreqs();
+
+ CALLGRIND_TOGGLE_COLLECT;
+
+ return sum;
+}
+
+ =20
+int main(void)
+{
+ more_callgrind_clreqs();
+
+ CALLGRIND_STOP_INSTRUMENTATION;
+
+ more_callgrind_clreqs();
+
+ CALLGRIND_START_INSTRUMENTATION;
+
+ more_callgrind_clreqs();
+
+ CALLGRIND_STOP_INSTRUMENTATION;
+
+ more_callgrind_clreqs();
+
+ CALLGRIND_START_INSTRUMENTATION;
+
return RUNNING_ON_VALGRIND;
}
=20
|