blob: df9df66f8ff75ab660de6649b27448bb291f7840 [file] [log] [blame]
njn31513b42005-06-01 03:09:59 +00001
2/*--------------------------------------------------------------------*/
3/*--- The built-in profiler. pub_tool_profile.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
10 Copyright (C) 2000-2005 Julian Seward
11 jseward@acm.org
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_TOOL_PROFILE_H
32#define __PUB_TOOL_PROFILE_H
33
34// Define this to turn on profiling.
35//#define VG_DO_PROFILING 1
36
37/* Override the empty definitions from tool.h */
38#ifdef VG_DO_PROFILING
39# define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
40# define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
41#else
42# define VGP_PUSHCC(x)
43# define VGP_POPCC(x)
44#endif
45
46/* Nb: VG_(register_profile_event)() relies on VgpUnc being the first one */
47#define VGP_CORE_LIST \
48 /* These ones depend on the core */ \
49 VGP_PAIR(VgpUnc, "unclassified"), \
50 VGP_PAIR(VgpStartup, "startup"), \
51 VGP_PAIR(VgpRun, "running"), \
52 VGP_PAIR(VgpSched, "scheduler"), \
53 VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \
54 VGP_PAIR(VgpCliMalloc, "client malloc/free"), \
55 VGP_PAIR(VgpTranslate, "translate-main"), \
56 VGP_PAIR(VgpVexTime, "Vex-time"), \
57 VGP_PAIR(VgpImprove, "improve"), \
58 VGP_PAIR(VgpESPUpdate, "ESP-update"), \
59 VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \
60 VGP_PAIR(VgpExeContext, "exe-context"), \
61 VGP_PAIR(VgpReadSyms, "read-syms"), \
62 VGP_PAIR(VgpSearchSyms, "search-syms"), \
63 VGP_PAIR(VgpAddToT, "add-to-transtab"), \
64 VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \
65 VGP_PAIR(VgpDemangle, "demangle"), \
66 VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \
67 VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \
68 /* These ones depend on the tool */ \
69 VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \
70 VGP_PAIR(VgpPostCloInit, "post-clo-init"), \
71 VGP_PAIR(VgpInstrument, "instrument"), \
72 VGP_PAIR(VgpToolSysWrap, "tool-syscall-wrapper"), \
73 VGP_PAIR(VgpToolCheapSanity, "tool-cheap-sanity"), \
74 VGP_PAIR(VgpToolExpensiveSanity, "tool-expensive-sanity"), \
75 VGP_PAIR(VgpFini, "fini")
76
77#define VGP_PAIR(n,name) n
78typedef enum { VGP_CORE_LIST } VgpCoreCC;
79#undef VGP_PAIR
80
81/* When registering tool profiling events, ensure that the 'n' value is in
82 * the range (VgpFini+1..) */
83extern void VG_(register_profile_event) ( Int n, Char* name );
84
85extern void VG_(pushcc) ( UInt cc );
86extern void VG_(popcc) ( UInt cc );
87
88#endif // __PUB_TOOL_PROFILE_H
89
90/*--------------------------------------------------------------------*/
91/*--- end ---*/
92/*--------------------------------------------------------------------*/