blob: 8ac9a694c7960d51d63cb18414c00555abd98cf6 [file] [log] [blame]
weidendoa17f2a32006-03-20 10:27:30 +00001
2/*
3 ----------------------------------------------------------------
4
5 Notice that the following BSD-style license applies to this one
njn7fd15d62006-03-31 12:05:04 +00006 file (mpiwrap.c) only. The rest of Valgrind is licensed under the
7 terms of the GNU General Public License, version 2, unless
8 otherwise indicated. See the COPYING file in the source
9 distribution for details.
weidendoa17f2a32006-03-20 10:27:30 +000010
11 ----------------------------------------------------------------
12
13 This file is part of callgrind, a valgrind skin for cache simulation
14 and call tree tracing.
15
16 Copyright (C) 2003,2004 Josef Weidendorfer. All rights reserved.
17
18 Redistribution and use in source and binary forms, with or without
19 modification, are permitted provided that the following conditions
20 are met:
21
22 1. Redistributions of source code must retain the above copyright
23 notice, this list of conditions and the following disclaimer.
24
25 2. The origin of this software must not be misrepresented; you must
26 not claim that you wrote the original software. If you use this
27 software in a product, an acknowledgment in the product
28 documentation would be appreciated but is not required.
29
30 3. Altered source versions must be plainly marked as such, and must
31 not be misrepresented as being the original software.
32
33 4. The name of the author may not be used to endorse or promote
34 products derived from this software without specific prior written
35 permission.
36
37 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
38 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
39 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
41 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
43 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
45 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
46 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
47 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48
49 ----------------------------------------------------------------
50
51 Notice that the above BSD-style license applies to this one file
52 (vgprof.h) only. The entire rest of Valgrind is licensed under
53 the terms of the GNU General Public License, version 2. See the
54 COPYING file in the source distribution for details.
55
56 ----------------------------------------------------------------
57*/
58
59#ifndef __CALLGRIND_H
60#define __CALLGRIND_H
61
62#include "valgrind.h"
63
64typedef
65 enum {
66 VG_USERREQ__DUMP_STATS = VG_USERREQ_TOOL_BASE('C','T'),
67 VG_USERREQ__ZERO_STATS,
68 VG_USERREQ__TOGGLE_COLLECT,
69 VG_USERREQ__DUMP_STATS_AT,
70 VG_USERREQ__START_INSTRUMENTATION,
71 VG_USERREQ__STOP_INSTRUMENTATION
72 } Vg_CalltreeClientRequest;
73
74/* Dump current state of cost centers.
75 This will also atomically zero the cost centers */
76#define CALLGRIND_DUMP_STATS() \
77 do { \
78 unsigned int _qzz_res; \
79 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__DUMP_STATS, \
80 0, 0, 0, 0); \
81 (void)0; \
82 } while(0)
83
84/* Dump current state of cost centers.
85 This will also atomically zero the cost centers */
86#define CALLGRIND_DUMP_STATS_AT(pos_str) \
87 do { \
88 unsigned int _qzz_res; \
89 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__DUMP_STATS_AT, \
90 pos_str, 0, 0, 0); \
91 (void)0; \
92 } while(0)
93
94/* Zero cost centers */
95#define CALLGRIND_ZERO_STATS() \
96 do { \
97 unsigned int _qzz_res; \
98 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__ZERO_STATS, \
99 0, 0, 0, 0); \
100 (void)0; \
101 } while(0)
102
103/* Toggle collection state,
104 * i.e. if events happening are collected into cost centers */
105#define CALLGRIND_TOGGLE_COLLECT() \
106 do { \
107 unsigned int _qzz_res; \
108 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__TOGGLE_COLLECT, \
109 0, 0, 0, 0); \
110 (void)0; \
111 } while(0)
112
113/* Start instrumentation if not already on */
114#define CALLGRIND_START_INSTRUMENTATION() \
115 do { \
116 unsigned int _qzz_res; \
117 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__START_INSTRUMENTATION,\
118 0, 0, 0, 0); \
119 (void)0; \
120 } while(0)
121
122/* Stop instrumentation if not already off */
123#define CALLGRIND_STOP_INSTRUMENTATION() \
124 do { \
125 unsigned int _qzz_res; \
126 VALGRIND_MAGIC_SEQUENCE(_qzz_res, 0, VG_USERREQ__STOP_INSTRUMENTATION,\
127 0, 0, 0, 0); \
128 (void)0; \
129 } while(0)
130
131#endif /* __CALLGRIND_H */