|
| 1 | +/* |
| 2 | + ---------------------------------------------------------------- |
| 3 | +
|
| 4 | + Notice that the following BSD-style license applies to this one |
| 5 | + file (callgrind.h) only. The rest of Valgrind is licensed under the |
| 6 | + terms of the GNU General Public License, version 2, unless |
| 7 | + otherwise indicated. See the COPYING file in the source |
| 8 | + distribution for details. |
| 9 | +
|
| 10 | + ---------------------------------------------------------------- |
| 11 | +
|
| 12 | + This file is part of callgrind, a valgrind tool for cache simulation |
| 13 | + and call tree tracing. |
| 14 | +
|
| 15 | + Copyright (C) 2003-2017 Josef Weidendorfer. All rights reserved. |
| 16 | +
|
| 17 | + Redistribution and use in source and binary forms, with or without |
| 18 | + modification, are permitted provided that the following conditions |
| 19 | + are met: |
| 20 | +
|
| 21 | + 1. Redistributions of source code must retain the above copyright |
| 22 | + notice, this list of conditions and the following disclaimer. |
| 23 | +
|
| 24 | + 2. The origin of this software must not be misrepresented; you must |
| 25 | + not claim that you wrote the original software. If you use this |
| 26 | + software in a product, an acknowledgment in the product |
| 27 | + documentation would be appreciated but is not required. |
| 28 | +
|
| 29 | + 3. Altered source versions must be plainly marked as such, and must |
| 30 | + not be misrepresented as being the original software. |
| 31 | +
|
| 32 | + 4. The name of the author may not be used to endorse or promote |
| 33 | + products derived from this software without specific prior written |
| 34 | + permission. |
| 35 | +
|
| 36 | + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 37 | + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 38 | + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 39 | + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 40 | + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 41 | + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 42 | + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 43 | + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 44 | + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 45 | + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 46 | + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 47 | +
|
| 48 | + ---------------------------------------------------------------- |
| 49 | +
|
| 50 | + Notice that the above BSD-style license applies to this one file |
| 51 | + (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 | + COPYING file in the source distribution for details. |
| 54 | +
|
| 55 | + ---------------------------------------------------------------- |
| 56 | +*/ |
| 57 | + |
| 58 | +#ifndef __CALLGRIND_H |
| 59 | +#define __CALLGRIND_H |
| 60 | + |
| 61 | +#include "valgrind.h" |
| 62 | + |
| 63 | +/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! |
| 64 | + This enum comprises an ABI exported by Valgrind to programs |
| 65 | + which use client requests. DO NOT CHANGE THE ORDER OF THESE |
| 66 | + ENTRIES, NOR DELETE ANY -- add new ones at the end. |
| 67 | +
|
| 68 | + The identification ('C','T') for Callgrind has historical |
| 69 | + reasons: it was called "Calltree" before. Besides, ('C','G') would |
| 70 | + clash with cachegrind. |
| 71 | + */ |
| 72 | + |
| 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; |
| 81 | + |
| 82 | +/* 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) |
| 85 | + |
| 86 | +/* Dump current state of cost centers, and zero them afterwards. |
| 87 | + The argument is appended to a string stating the reason which triggered |
| 88 | + the dump. This string is written as a description field into the |
| 89 | + 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) |
| 93 | + |
| 94 | +/* Zero cost centers */ |
| 95 | +#define CALLGRIND_ZERO_STATS \ |
| 96 | + VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__ZERO_STATS, 0, 0, 0, 0, 0) |
| 97 | + |
| 98 | +/* Toggles collection state. |
| 99 | + The collection state specifies whether the happening of events |
| 100 | + should be noted or if they are to be ignored. Events are noted |
| 101 | + 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) |
| 104 | + |
| 105 | +/* Start full callgrind instrumentation if not already switched on. |
| 106 | + When cache simulation is done, it will flush the simulated cache; |
| 107 | + this will lead to an artificial cache warmup phase afterwards with |
| 108 | + 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) |
| 112 | + |
| 113 | +/* Stop full callgrind instrumentation if not already switched off. |
| 114 | + This flushes Valgrinds translation cache, and does no additional |
| 115 | + instrumentation afterwards, which effectivly will run at the same |
| 116 | + speed as the "none" tool (ie. at minimal slowdown). |
| 117 | + Use this to bypass Callgrind aggregation for uninteresting code parts. |
| 118 | + To start Callgrind in this mode to ignore the setup phase, use |
| 119 | + 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) |
| 123 | + |
| 124 | +#endif /* __CALLGRIND_H */ |
0 commit comments