blob: a04b9891abb88f0486b9a53957fe0fead3e05036 [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
njnc7561b92005-06-19 01:24:32 +000034// Define this to turn on profiling. (But it's currently not working...)
njn31513b42005-06-01 03:09:59 +000035//#define VG_DO_PROFILING 1
36
njn31513b42005-06-01 03:09:59 +000037#ifdef VG_DO_PROFILING
38# define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
39# define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
40#else
41# define VGP_PUSHCC(x)
42# define VGP_POPCC(x)
43#endif
44
45/* Nb: VG_(register_profile_event)() relies on VgpUnc being the first one */
46#define VGP_CORE_LIST \
47 /* These ones depend on the core */ \
48 VGP_PAIR(VgpUnc, "unclassified"), \
49 VGP_PAIR(VgpStartup, "startup"), \
50 VGP_PAIR(VgpRun, "running"), \
51 VGP_PAIR(VgpSched, "scheduler"), \
52 VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \
53 VGP_PAIR(VgpCliMalloc, "client malloc/free"), \
54 VGP_PAIR(VgpTranslate, "translate-main"), \
55 VGP_PAIR(VgpVexTime, "Vex-time"), \
56 VGP_PAIR(VgpImprove, "improve"), \
57 VGP_PAIR(VgpESPUpdate, "ESP-update"), \
58 VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \
59 VGP_PAIR(VgpExeContext, "exe-context"), \
60 VGP_PAIR(VgpReadSyms, "read-syms"), \
61 VGP_PAIR(VgpSearchSyms, "search-syms"), \
62 VGP_PAIR(VgpAddToT, "add-to-transtab"), \
63 VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \
64 VGP_PAIR(VgpDemangle, "demangle"), \
65 VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \
66 VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \
67 /* These ones depend on the tool */ \
68 VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \
69 VGP_PAIR(VgpPostCloInit, "post-clo-init"), \
70 VGP_PAIR(VgpInstrument, "instrument"), \
71 VGP_PAIR(VgpToolSysWrap, "tool-syscall-wrapper"), \
72 VGP_PAIR(VgpToolCheapSanity, "tool-cheap-sanity"), \
73 VGP_PAIR(VgpToolExpensiveSanity, "tool-expensive-sanity"), \
74 VGP_PAIR(VgpFini, "fini")
75
76#define VGP_PAIR(n,name) n
77typedef enum { VGP_CORE_LIST } VgpCoreCC;
78#undef VGP_PAIR
79
80/* When registering tool profiling events, ensure that the 'n' value is in
81 * the range (VgpFini+1..) */
82extern void VG_(register_profile_event) ( Int n, Char* name );
83
84extern void VG_(pushcc) ( UInt cc );
85extern void VG_(popcc) ( UInt cc );
86
87#endif // __PUB_TOOL_PROFILE_H
88
89/*--------------------------------------------------------------------*/
90/*--- end ---*/
91/*--------------------------------------------------------------------*/