Skip to content

Commit 2555267

Browse files
committed
chore: sync includes/callgrind.h with valgrind-codspeed
Replace the bundled callgrind.h with a verbatim copy of callgrind/callgrind.h from CodSpeedHQ/valgrind-codspeed@master, picking up VG_USERREQ__ADD_OBJ_SKIP and the CALLGRIND_ADD_OBJ_SKIP macro. License updated to GPLv3 to match the fork.
1 parent 3d13108 commit 2555267

1 file changed

Lines changed: 37 additions & 25 deletions

File tree

includes/callgrind.h

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
12
/*
23
----------------------------------------------------------------
34
45
Notice that the following BSD-style license applies to this one
56
file (callgrind.h) only. The rest of Valgrind is licensed under the
6-
terms of the GNU General Public License, version 2, unless
7+
terms of the GNU General Public License, version 3, unless
78
otherwise indicated. See the COPYING file in the source
89
distribution for details.
910
@@ -49,7 +50,7 @@
4950
5051
Notice that the above BSD-style license applies to this one file
5152
(callgrind.h) only. The entire rest of Valgrind is licensed under
52-
the terms of the GNU General Public License, version 2. See the
53+
the terms of the GNU General Public License, version 3. See the
5354
COPYING file in the source distribution for details.
5455
5556
----------------------------------------------------------------
@@ -70,45 +71,50 @@
7071
clash with cachegrind.
7172
*/
7273

73-
typedef enum {
74-
VG_USERREQ__DUMP_STATS = VG_USERREQ_TOOL_BASE('C', 'T'),
75-
VG_USERREQ__ZERO_STATS,
76-
VG_USERREQ__TOGGLE_COLLECT,
77-
VG_USERREQ__DUMP_STATS_AT,
78-
VG_USERREQ__START_INSTRUMENTATION,
79-
VG_USERREQ__STOP_INSTRUMENTATION
80-
} Vg_CallgrindClientRequest;
74+
typedef
75+
enum {
76+
VG_USERREQ__DUMP_STATS = VG_USERREQ_TOOL_BASE('C','T'),
77+
VG_USERREQ__ZERO_STATS,
78+
VG_USERREQ__TOGGLE_COLLECT,
79+
VG_USERREQ__DUMP_STATS_AT,
80+
VG_USERREQ__START_INSTRUMENTATION,
81+
VG_USERREQ__STOP_INSTRUMENTATION,
82+
VG_USERREQ__ADD_OBJ_SKIP
83+
} Vg_CallgrindClientRequest;
8184

8285
/* Dump current state of cost centers, and zero them afterwards */
83-
#define CALLGRIND_DUMP_STATS \
84-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DUMP_STATS, 0, 0, 0, 0, 0)
86+
#define CALLGRIND_DUMP_STATS \
87+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DUMP_STATS, \
88+
0, 0, 0, 0, 0)
8589

8690
/* Dump current state of cost centers, and zero them afterwards.
8791
The argument is appended to a string stating the reason which triggered
8892
the dump. This string is written as a description field into the
8993
profile data dump. */
90-
#define CALLGRIND_DUMP_STATS_AT(pos_str) \
91-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DUMP_STATS_AT, pos_str, 0, 0, 0, \
92-
0)
94+
#define CALLGRIND_DUMP_STATS_AT(pos_str) \
95+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DUMP_STATS_AT, \
96+
pos_str, 0, 0, 0, 0)
9397

9498
/* Zero cost centers */
95-
#define CALLGRIND_ZERO_STATS \
96-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__ZERO_STATS, 0, 0, 0, 0, 0)
99+
#define CALLGRIND_ZERO_STATS \
100+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__ZERO_STATS, \
101+
0, 0, 0, 0, 0)
97102

98103
/* Toggles collection state.
99104
The collection state specifies whether the happening of events
100105
should be noted or if they are to be ignored. Events are noted
101106
by increment of counters in a cost center */
102-
#define CALLGRIND_TOGGLE_COLLECT \
103-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__TOGGLE_COLLECT, 0, 0, 0, 0, 0)
107+
#define CALLGRIND_TOGGLE_COLLECT \
108+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__TOGGLE_COLLECT, \
109+
0, 0, 0, 0, 0)
104110

105111
/* Start full callgrind instrumentation if not already switched on.
106112
When cache simulation is done, it will flush the simulated cache;
107113
this will lead to an artificial cache warmup phase afterwards with
108114
cache misses which would not have happened in reality. */
109-
#define CALLGRIND_START_INSTRUMENTATION \
110-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__START_INSTRUMENTATION, 0, 0, 0, \
111-
0, 0)
115+
#define CALLGRIND_START_INSTRUMENTATION \
116+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__START_INSTRUMENTATION, \
117+
0, 0, 0, 0, 0)
112118

113119
/* Stop full callgrind instrumentation if not already switched off.
114120
This flushes Valgrinds translation cache, and does no additional
@@ -117,8 +123,14 @@ typedef enum {
117123
Use this to bypass Callgrind aggregation for uninteresting code parts.
118124
To start Callgrind in this mode to ignore the setup phase, use
119125
the option "--instr-atstart=no". */
120-
#define CALLGRIND_STOP_INSTRUMENTATION \
121-
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STOP_INSTRUMENTATION, 0, 0, 0, \
122-
0, 0)
126+
#define CALLGRIND_STOP_INSTRUMENTATION \
127+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STOP_INSTRUMENTATION, \
128+
0, 0, 0, 0, 0)
129+
130+
/* Add an object file path to the obj-skip list at runtime. Path matching
131+
is exact (same as --obj-skip=<path> on the command line). */
132+
#define CALLGRIND_ADD_OBJ_SKIP(path) \
133+
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__ADD_OBJ_SKIP, \
134+
path, 0, 0, 0, 0)
123135

124136
#endif /* __CALLGRIND_H */

0 commit comments

Comments
 (0)