|
From: <sv...@va...> - 2006-03-31 19:34:57
|
Author: weidendo
Date: 2006-03-31 20:34:51 +0100 (Fri, 31 Mar 2006)
New Revision: 5807
Log:
Simple regression test for callgrind:
run a custom client request.
By doing this, I found out that callgrind.h still defined
client requests for VG 2 :-( Obviously, nobody was using
them. This is fixed, and other small things to make the
test run, too.
Notice for myself: regression tests are needed.
Added:
trunk/callgrind/tests/clreq.c
trunk/callgrind/tests/clreq.stderr.exp
trunk/callgrind/tests/clreq.vgtest
trunk/callgrind/tests/filter_stderr
Modified:
trunk/callgrind/callgrind.h
trunk/callgrind/main.c
trunk/callgrind/tests/
trunk/callgrind/tests/Makefile.am
Modified: trunk/callgrind/callgrind.h
=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/callgrind.h 2006-03-31 13:16:15 UTC (rev 5806)
+++ trunk/callgrind/callgrind.h 2006-03-31 19:34:51 UTC (rev 5807)
@@ -13,7 +13,7 @@
This file is part of callgrind, a valgrind skin for cache simulation
and call tree tracing.
=20
- Copyright (C) 2003,2004 Josef Weidendorfer. All rights reserved.
+ Copyright (C) 2003-2006 Josef Weidendorfer. All rights reserved.
=20
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -61,6 +61,16 @@
=20
#include "valgrind.h"
=20
+/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !!
+ This enum comprises an ABI exported by Valgrind to programs
+ which use client requests. DO NOT CHANGE THE ORDER OF THESE
+ ENTRIES, NOR DELETE ANY -- add new ones at the end.
+
+ The identification ('C','T') for Callgrind has historical
+ reasons: it was called "Calltree" before. Besides, ('C','G') would
+ clash with cachegrind.
+ */
+
typedef
enum {
VG_USERREQ__DUMP_STATS =3D VG_USERREQ_TOOL_BASE('C','T'),
@@ -69,63 +79,69 @@
VG_USERREQ__DUMP_STATS_AT,
VG_USERREQ__START_INSTRUMENTATION,
VG_USERREQ__STOP_INSTRUMENTATION
- } Vg_CalltreeClientRequest;
+ } Vg_CallgrindClientRequest;
=20
-/* Dump current state of cost centers.
- This will also atomically zero the cost centers */
-#define CALLGRIND_DUMP_STATS() \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__DUMP_STATS, \
- 0, 0, 0, 0); \
- (void)0; \
- } while(0)
+/* Dump current state of cost centers, and zero them afterwards */
+#define CALLGRIND_DUMP_STATS =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__DUMP_STATS, =
\
+ 0, 0, 0, 0, 0); =
\
+ }
=20
-/* Dump current state of cost centers.
- This will also atomically zero the cost centers */
-#define CALLGRIND_DUMP_STATS_AT(pos_str) \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__DUMP_STATS_AT, \
- pos_str, 0, 0, 0); \
- (void)0; \
- } while(0)
+/* Dump current state of cost centers, and zero them afterwards.
+ The argument is appended to a string stating the reason which trigger=
ed
+ the dump. This string is written as a description field into the
+ profile data dump. */
+#define CALLGRIND_DUMP_STATS_AT(pos_str) =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__DUMP_STATS_AT, =
\
+ pos_str, 0, 0, 0, 0); =
\
+ }
=20
/* Zero cost centers */
-#define CALLGRIND_ZERO_STATS() \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__ZERO_STATS, \
- 0, 0, 0, 0); \
- (void)0; \
- } while(0)
+#define CALLGRIND_ZERO_STATS =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__ZERO_STATS, =
\
+ 0, 0, 0, 0, 0); =
\
+ }
=20
-/* Toggle collection state,
- * i.e. if events happening are collected into cost centers */
-#define CALLGRIND_TOGGLE_COLLECT() \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__TOGGLE_COLLECT, \
- 0, 0, 0, 0); \
- (void)0; \
- } while(0)
+/* Toggles collection state.
+ The collection state specifies whether the happening of events
+ should be noted or if they are to be ignored. Events are noted
+ by increment of counters in a cost center */
+#define CALLGRIND_TOGGLE_COLLECT =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__TOGGLE_COLLECT, =
\
+ 0, 0, 0, 0, 0); =
\
+ }
=20
-/* Start instrumentation if not already on */
-#define CALLGRIND_START_INSTRUMENTATION() \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__START_INSTRUMENTAT=
ION,\
- 0, 0, 0, 0); \
- (void)0; \
- } while(0)
+/* Start full callgrind instrumentation if not already switched on.
+ When cache simulation is done, it will flush the simulated cache;
+ this will lead to an artifical cache warmup phase afterwards with
+ cache misses which would not have happened in reality. */
+#define CALLGRIND_START_INSTRUMENTATION =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__START_INSTRUMENTATION, =
\
+ 0, 0, 0, 0, 0); =
\
+ }
=20
-/* Stop instrumentation if not already off */
-#define CALLGRIND_STOP_INSTRUMENTATION() \
- do { \
- unsigned int _qzz_res; \
- VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__STOP_INSTRUMENTATI=
ON,\
- 0, 0, 0, 0); \
- (void)0; \
- } while(0)
+/* Stop full callgrind instrumentation if not already switched off.
+ This flushes Valgrinds translation cache, and does no additional
+ instrumentation afterwards, which effectivly will run at the same
+ speed as the "none" tool (ie. at minimal slowdown).
+ Use this to bypass Callgrind aggregation for uninteresting code parts=
.
+ To start Callgrind in this mode to ignore the setup phase, use
+ the option "--instr-atstart=3Dno". */
+#define CALLGRIND_STOP_INSTRUMENTATION =
\
+ {unsigned int _qzz_res; =
\
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, =
\
+ VG_USERREQ__STOP_INSTRUMENTATION, =
\
+ 0, 0, 0, 0, 0); =
\
+ }
=20
#endif /* __CALLGRIND_H */
Modified: trunk/callgrind/main.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/main.c 2006-03-31 13:16:15 UTC (rev 5806)
+++ trunk/callgrind/main.c 2006-03-31 19:34:51 UTC (rev 5807)
@@ -801,7 +801,7 @@
case VG_USERREQ__DUMP_STATS_AT:
{
Char buf[512];
- VG_(sprintf)(buf,"Client Request: %d", args[1]);
+ VG_(sprintf)(buf,"Client Request: %s", args[1]);
CLG_(dump_profile)(buf, True);
*ret =3D 0; /* meaningless */
}
@@ -1042,20 +1042,23 @@
=20
CLG_(instrument_state) =3D CLG_(clo).instrument_atstart;
=20
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "For interactive control, run 'callgrind_con=
trol -h'.");
+ if (VG_(clo_verbosity > 0)) {
+ VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg,
+ "For interactive control, run 'callgrind_control -h'.=
");
+ }
}
=20
static
void CLG_(pre_clo_init)(void)
{
VG_(details_name) ("Callgrind");
- VG_(details_version) (VERSION);
+ VG_(details_version) (NULL);
VG_(details_description) ("a call-graph generating cache profile=
r");
VG_(details_copyright_author)("Copyright (C) 2002-2006, and GNU GPL'=
d, "
- "by J.Weidendorfer et al.");
+ "by Josef Weidendorfer et al.");
VG_(details_bug_reports_to) ("Jos...@gm...");
- VG_(details_avg_translation_sizeB) ( 155 );
+ VG_(details_avg_translation_sizeB) ( 245 );
=20
VG_(basic_tool_funcs) (CLG_(post_clo_init),
CLG_(instrument),
Property changes on: trunk/callgrind/tests
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
+ callgrind.out.*
clreq
.deps
Makefile
Makefile.in
*.stderr.diff
*.stderr.out
*.stdout.diff
*.stdout.out
Modified: trunk/callgrind/tests/Makefile.am
=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/Makefile.am 2006-03-31 13:16:15 UTC (rev 5806)
+++ trunk/callgrind/tests/Makefile.am 2006-03-31 19:34:51 UTC (rev 5807)
@@ -4,11 +4,13 @@
SUBDIRS =3D .
DIST_SUBDIRS =3D .
=20
-noinst_SCRIPTS =3D=20
+noinst_SCRIPTS =3D filter_stderr
=20
-EXTRA_DIST =3D=20
+EXTRA_DIST =3D clreq.vgtest clreq.stderr.exp=20
=20
-check_PROGRAMS =3D=20
+check_PROGRAMS =3D clreq
=20
AM_CPPFLAGS =3D -I$(top_srcdir)/include
AM_CFLAGS =3D $(WERROR) -Winline -Wall -Wshadow -g $(AM_FLAG_M3264_PRI=
)
+
+
Added: 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 (rev 0)
+++ trunk/callgrind/tests/clreq.c 2006-03-31 19:34:51 UTC (rev 5807)
@@ -0,0 +1,13 @@
+
+// Similar to Cachegrind, check if instrumentation works in the presence
+// of a client request. Uses a Callgrind request to check this.
+
+#include "../callgrind.h"
+
+int main(void)
+{
+ CALLGRIND_ZERO_STATS;
+
+ return RUNNING_ON_VALGRIND;
+}
+
Added: trunk/callgrind/tests/clreq.stderr.exp
=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
Added: trunk/callgrind/tests/clreq.vgtest
=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.vgtest (rev 0)
+++ trunk/callgrind/tests/clreq.vgtest 2006-03-31 19:34:51 UTC (rev 5807)
@@ -0,0 +1,3 @@
+prog: clreq
+vgopts: -q
+cleanup: rm callgrind.out.*
Added: trunk/callgrind/tests/filter_stderr
=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/filter_stderr (rev 0)
+++ trunk/callgrind/tests/filter_stderr 2006-03-31 19:34:51 UTC (rev 5807=
)
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+dir=3D`dirname $0`
+
+$dir/../../tests/filter_stderr_basic |
+
+# Remove "Callgrind, ..." line and the following copyright line.
+sed "/^Callgrind, a call-graph generating cache profiler./ , /./ d" |
+
+# Remove numbers from I/D/L2 "refs:" lines
+sed "s/\(\(I\|D\|L2\) *refs:\)[ 0-9,()+rdw]*$/\1/" |
+
+# Remove numbers from I1/D1/L2/L2i/L2d "misses:" and "miss rates:" lines
+sed "s/\(\(I1\|D1\|L2\|L2i\|L2d\) *\(misses\|miss rate\):\)[ 0-9,()+rdw%=
\.]*$/\1/" |
+
+# Remove CPUID warnings lines for P4s and other machines
+sed "/warning: Pentium 4 with 12 KB micro-op instruction trace cache/d" =
|
+sed "/Simulating a 16 KB I-cache with 32 B lines/d" |
+sed "/warning: L3 cache detected but ignored/d" |
+sed "/Warning: Cannot auto-detect cache config on PPC.., using one or mo=
re defaults/d"
Property changes on: trunk/callgrind/tests/filter_stderr
___________________________________________________________________
Name: svn:executable
+ *
|