Author: njn
Date: 2005-06-01 04:09:59 +0100 (Wed, 01 Jun 2005)
New Revision: 3833
Added:
trunk/coregrind/m_profile.c
trunk/coregrind/pub_core_profile.h
trunk/include/pub_tool_profile.h
Removed:
trunk/coregrind/vg_dummy_profile.c
trunk/include/vg_profile.c
Modified:
trunk/addrcheck/ac_main.c
trunk/cachegrind/cg_main.c
trunk/coregrind/Makefile.am
trunk/coregrind/core.h
trunk/coregrind/m_debuginfo/symtab.c
trunk/coregrind/m_demangle/demangle.c
trunk/coregrind/m_execontext.c
trunk/coregrind/m_main.c
trunk/coregrind/m_mallocfree.c
trunk/coregrind/m_scheduler/scheduler.c
trunk/coregrind/m_stacktrace.c
trunk/coregrind/m_syscalls/syscalls.c
trunk/coregrind/m_translate.c
trunk/helgrind/hg_main.c
trunk/include/Makefile.am
trunk/include/tool.h
trunk/massif/ms_main.c
trunk/memcheck/mac_shared.h
Log:
Modularised the profiling stuff as m_profile.c. It's much more=20
sensible now -- no vg_dummy_profile.c, no silly #including of
vg_profile.c from tools. =20
Unfortunately, it still doesn't work, due to bad interactions
with signal handling that I don't understand.
Modified: trunk/addrcheck/ac_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/addrcheck/ac_main.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/addrcheck/ac_main.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -32,7 +32,6 @@
=20
#include "mac_shared.h"
#include "memcheck.h"
-//#include "vg_profile.c"
=20
=20
/*------------------------------------------------------------*/
Modified: trunk/cachegrind/cg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/cachegrind/cg_main.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/cachegrind/cg_main.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -34,6 +34,7 @@
#include "pub_tool_hashtable.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
+#include "pub_tool_profile.h"
#include "pub_tool_tooliface.h"
=20
#include "cg_arch.h"
Modified: trunk/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/Makefile.am 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/Makefile.am 2005-06-01 03:09:59 UTC (rev 3833)
@@ -49,6 +49,7 @@
pub_core_main.h \
pub_core_mallocfree.h \
pub_core_options.h \
+ pub_core_profile.h \
pub_core_redir.h \
pub_core_replacemalloc.h\
pub_core_scheduler.h \
@@ -89,6 +90,7 @@
m_main.c \
m_mallocfree.c \
m_options.c \
+ m_profile.c \
m_redir.c \
m_signals.c \
m_skiplist.c \
@@ -100,7 +102,6 @@
ume.c \
vg_messages.c \
vg_mylibc.c \
- vg_dummy_profile.c \
vg_threadmodel.c \
vg_pthreadmodel.c
=20
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/core.h 2005-06-01 03:09:59 UTC (rev 3833)
@@ -88,19 +88,6 @@
extern Int VG_(fd_hard_limit);
=20
/* ---------------------------------------------------------------------
- Profiling stuff
- ------------------------------------------------------------------ */
-
-extern void VG_(init_profiling) ( void );
-extern void VG_(done_profiling) ( void );
-
-#undef VGP_PUSHCC
-#undef VGP_POPCC
-#define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
-#define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
-
-
-/* ---------------------------------------------------------------------
Exports of vg_intercept.c
------------------------------------------------------------------ */
=20
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2005-06-01 00:03:17 UTC (rev 383=
2)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-06-01 03:09:59 UTC (rev 383=
3)
@@ -33,6 +33,7 @@
#include "pub_core_aspacemgr.h"
#include "pub_core_demangle.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "pub_core_redir.h"
#include "pub_core_tooliface.h"
#include "priv_symtab.h"
Modified: trunk/coregrind/m_demangle/demangle.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_demangle/demangle.c 2005-06-01 00:03:17 UTC (rev 38=
32)
+++ trunk/coregrind/m_demangle/demangle.c 2005-06-01 03:09:59 UTC (rev 38=
33)
@@ -31,6 +31,7 @@
#include "core.h"
#include "pub_core_demangle.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "demangle.h"
=20
void VG_(demangle) ( Char* orig, Char* result, Int result_size )
Modified: trunk/coregrind/m_execontext.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_execontext.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/m_execontext.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -31,6 +31,7 @@
#include "core.h"
#include "pub_core_execontext.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
=20
/*------------------------------------------------------------*/
/*--- Low-level ExeContext storage. ---*/
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/m_main.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -38,6 +38,7 @@
#include "pub_core_execontext.h"
#include "pub_core_main.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "pub_core_redir.h"
#include "pub_core_signals.h"
#include "pub_core_syscalls.h"
Modified: trunk/coregrind/m_mallocfree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_mallocfree.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/m_mallocfree.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -33,6 +33,7 @@
#include "core.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "valgrind.h"
=20
//zz#include "memcheck/memcheck.h"
Copied: trunk/coregrind/m_profile.c (from rev 3830, trunk/include/vg_prof=
ile.c)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/vg_profile.c 2005-05-31 22:15:14 UTC (rev 3830)
+++ trunk/coregrind/m_profile.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -0,0 +1,169 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Profiling machinery. m_profile.c ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward=20
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#include "core.h"
+#include "pub_core_profile.h"
+
+/* get rid of these, if possible */
+#include <signal.h>
+#include <sys/time.h>
+
+
+#define VGP_M_STACK 20
+#define VGP_MAX_CCS 50
+
+/* All zeroed initially because they're static */
+static Int vgp_nticks;
+
+static Int vgp_counts [VGP_MAX_CCS];
+static Int vgp_entries[VGP_MAX_CCS];
+static Char* vgp_names [VGP_MAX_CCS];
+
+static Int vgp_sp;
+static UInt vgp_stack[VGP_M_STACK];
+
+/* These definitions override the panicking ones in vg_profile.c */
+
+void VG_(register_profile_event) ( Int n, Char* name )
+{
+ /* Adjust for negative values */
+ n +=3D VgpUnc;
+ if (n >=3D VGP_MAX_CCS) {
+ VG_(printf)("\nProfile event #%d higher than VGP_MAX_CCS of %d.\n"
+ "If you really need this many profile events, increase=
\n"
+ "VGP_MAX_CCS and recompile Valgrind.\n",
+ n, VGP_MAX_CCS);
+ VG_(tool_panic)("profile event too high");
+ }
+ if (vgp_names[n] !=3D NULL) {
+ VG_(printf)("\nProfile event #%d being registered as '%s'\n"
+ "already registered as '%s'.\n"
+ "Note that tool and core event numbers must not overla=
p.\n",
+ n, name, vgp_names[n]);
+ VG_(tool_panic)("profile event already registered");
+ }
+
+ vgp_names[n] =3D name;
+}
+
+static void tick ( int sigNo )
+{
+ Int cc;
+ vgp_nticks++;
+ cc =3D vgp_stack[vgp_sp];
+ tl_assert(cc >=3D 0 && cc < VGP_MAX_CCS);
+ vgp_counts[ cc ]++;
+}
+
+void VG_(init_profiling) ( void )
+{
+ struct itimerval value;
+ Int ret;
+
+#ifndef VG_DO_PROFILING
+ VG_(printf)("valgrind: you must compile with VG_DO_PROFILING defined=
\n");
+ VG_(printf)(" before using --profile=3Dyes. Aborting.\n");
+ VG_(exit)(1);
+#endif
+
+ /* Register core events... tricky macro definition causes
+ VG_(register_profile_event)() to be called once for each core even=
t
+ in VGP_CORE_LIST. */
+ tl_assert(VgpUnc =3D=3D 0);
+# define VGP_PAIR(n,name) VG_(register_profile_event)(n,name)
+ VGP_CORE_LIST;
+# undef VGP_PAIR
+
+ vgp_sp =3D -1;
+ VG_(pushcc) ( VgpUnc );
+
+ value.it_interval.tv_sec =3D 0;
+ value.it_interval.tv_usec =3D 10 * 1000;
+ value.it_value =3D value.it_interval;
+
+ signal(SIGPROF, tick );
+ ret =3D setitimer(ITIMER_PROF, &value, NULL);
+ if (ret !=3D 0) VG_(core_panic)("vgp_init_profiling");
+}
+
+void VG_(done_profiling) ( void )
+{
+ Int i;
+ VG_(printf)("\nProfiling done, %d ticks\n", vgp_nticks);
+ for (i =3D 0; i < VGP_MAX_CCS; i++)
+ if (NULL !=3D vgp_names[i])
+ VG_(printf)(
+ "%2d: %4d (%3d %%%%) ticks, %10d entries for %s\n",
+ i, vgp_counts[i],=20
+ (Int)(1000.0 * (double)vgp_counts[i] / (double)vgp_nticks),
+ vgp_entries[i], vgp_names[i] );
+}
+
+void VG_(pushcc) ( UInt cc )
+{
+ if (vgp_sp >=3D VGP_M_STACK-1) {=20
+ VG_(printf)(
+ "\nMaximum profile stack depth (%d) reached for event #%d ('%s'=
).\n"
+ "This is probably due to a VG_(pushcc)() without a matching\n"
+ "VG_(popcc)(). Make sure they all match.\n"
+ "Or if you are nesting profiling events very deeply, increase\n=
"
+ "VGP_M_STACK and recompile Valgrind.\n",
+ VGP_M_STACK, cc, vgp_names[cc]);
+ VG_(core_panic)("Profiling stack overflow");
+ }
+ vgp_sp++;
+ vgp_stack[vgp_sp] =3D cc;
+ vgp_entries[ cc ] ++;
+}
+
+void VG_(popcc) ( UInt cc )
+{
+ if (vgp_sp <=3D 0) {
+ VG_(printf)(
+ "\nProfile stack underflow. This is due to a VG_(popcc)() with=
out\n"
+ "a matching VG_(pushcc)(). Make sure they all match.\n");
+ VG_(core_panic)("Profiling stack underflow");
+ }
+ if (vgp_stack[vgp_sp] !=3D cc) {
+ Int i;
+ VG_(printf)("profiling problem:\n");
+ VG_(printf)("popping %s, stack looks like:\n", vgp_names[cc]);
+ for (i =3D vgp_sp; i >=3D 0; i--)
+ VG_(printf)("%2d: %s\n", i, vgp_names[vgp_stack[i]]);
+ VG_(exit)(1);
+ }
+ vgp_sp--;
+}
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
+
+
Modified: trunk/coregrind/m_scheduler/scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_scheduler/scheduler.c 2005-06-01 00:03:17 UTC (rev =
3832)
+++ trunk/coregrind/m_scheduler/scheduler.c 2005-06-01 03:09:59 UTC (rev =
3833)
@@ -65,6 +65,7 @@
#include "pub_core_errormgr.h"
#include "pub_core_main.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "pub_core_replacemalloc.h"
#include "pub_core_scheduler.h"
#include "pub_core_signals.h"
Modified: trunk/coregrind/m_stacktrace.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_stacktrace.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/m_stacktrace.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -31,6 +31,7 @@
#include "core.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "pub_core_stacktrace.h"
=20
/*------------------------------------------------------------*/
Modified: trunk/coregrind/m_syscalls/syscalls.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls.c 2005-06-01 00:03:17 UTC (rev 38=
32)
+++ trunk/coregrind/m_syscalls/syscalls.c 2005-06-01 03:09:59 UTC (rev 38=
33)
@@ -32,6 +32,7 @@
#include "pub_core_debuglog.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_main.h"
+#include "pub_core_profile.h"
#include "pub_core_stacktrace.h"
#include "pub_core_syscalls.h"
#include "pub_core_tooliface.h"
@@ -6071,7 +6072,7 @@
Bool runInLWP =3D False;
Bool syscall_done =3D False; /* we actually ran the syscall */
=20
- VGP_PUSHCC(VgpCoreSysWrap);
+// VGP_PUSHCC(VgpCoreSysWrap);
=20
tst =3D VG_(get_ThreadState)(tid);
=20
@@ -6198,7 +6199,7 @@
/* VG_(post_syscall) should set this */
vg_assert(tst->syscallno =3D=3D -1);
=20
- VGP_POPCC(VgpCoreSysWrap);
+// VGP_POPCC(VgpCoreSysWrap);
}
=20
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_translate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_translate.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/m_translate.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -33,6 +33,7 @@
#include "pub_core_aspacemgr.h"
#include "pub_core_main.h" // for VG_(bbs_done)
#include "pub_core_options.h"
+#include "pub_core_profile.h"
#include "pub_core_redir.h"
#include "pub_core_signals.h"
#include "pub_core_tooliface.h"
@@ -468,6 +469,8 @@
verbosity =3D VG_(clo_trace_flags);
}
=20
+ VGP_PUSHCC(VgpVexTime);
+ =20
/* Actually do the translation. */
tl_assert2(VG_(tdict).tool_instrument,
"you forgot to set VgToolInterface function 'tool_instrume=
nt'");
@@ -492,6 +495,8 @@
vg_assert(tmpbuf_used <=3D N_TMPBUF);
vg_assert(tmpbuf_used > 0);
=20
+ VGP_POPCC(VgpVexTime);
+
#undef DECIDE_IF_PRINTING_CODEGEN
=20
/* Copy data at trans_addr into the translation cache. */
Added: trunk/coregrind/pub_core_profile.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_profile.h 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/pub_core_profile.h 2005-06-01 03:09:59 UTC (rev 3833)
@@ -0,0 +1,50 @@
+
+/*--------------------------------------------------------------------*/
+/*--- The built-in profiler. pub_core_profile.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_CORE_PROFILE_H
+#define __PUB_CORE_PROFILE_H
+
+//--------------------------------------------------------------------
+// PURPOSE: This module implements Valgrind's internal tick-and-stack-ba=
sed
+// profiler. To use it, define VG_DO_PROFILING and use --profile=3Dyes.
+// Unfortunately, it's currently broken (and has been for some time)
+// because it doesn't interact well with signal handling.
+//--------------------------------------------------------------------
+
+#include "pub_tool_profile.h"
+
+extern void VG_(init_profiling) ( void );
+extern void VG_(done_profiling) ( void );
+
+#endif // __PUB_CORE_PROFILE_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Deleted: trunk/coregrind/vg_dummy_profile.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_dummy_profile.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/coregrind/vg_dummy_profile.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -1,71 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Dummy profiling machinery -- overridden by tools when they ---*/
-/*--- want profiling. ---*/
-/*--- vg_dummy_profile.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "core.h"
-
-static void vgp_die(void)
-{
- VG_(printf)(
- "\nProfiling error:\n"
- " The --profile=3Dyes option was specified, but the tool\n"
- " wasn't built for profiling. #include \"vg_profile.c\"\n"
- " into the tool and rebuild to allow profiling.\n\n");
- VG_(exit)(1);
-}
-
-void VG_(register_profile_event) ( Int n, Char* name )
-{
-}
-
-void VG_(init_profiling) ( void )
-{
- vgp_die();
-}
-
-void VG_(done_profiling) ( void )
-{
- VG_(core_panic)("done_profiling(), but not compiled for profiling??")=
;
-}
-
-void VG_(pushcc) ( UInt cc )
-{
- vgp_die();
-}
-
-void VG_(popcc) ( UInt cc )
-{
- vgp_die();
-}
-
-/*--------------------------------------------------------------------*/
-/*--- end vg_dummy_profile.c ---*/
-/*--------------------------------------------------------------------*/
Modified: trunk/helgrind/hg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/helgrind/hg_main.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/helgrind/hg_main.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -34,6 +34,7 @@
#include "pub_tool_hashtable.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
+#include "pub_tool_profile.h"
#include "pub_tool_replacemalloc.h"
#include "pub_tool_tooliface.h"
=20
@@ -1613,7 +1614,7 @@
"Warning: set address range state: large range %d",
len);
=20
- VGP_PUSHCC(VgpSARP);
+ //VGP_PUSHCC(VgpSARP);
=20
/* Remove mutexes in recycled memory range from hash */
find_mutex_range(a, a+len, cleanmx);
@@ -1661,7 +1662,7 @@
VG_(tool_panic)("Unexpected Vge_InitStatus");
}
=20
- VGP_POPCC(VgpSARP);
+ //VGP_POPCC(VgpSARP);
}
=20
=20
Modified: trunk/include/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/Makefile.am 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/include/Makefile.am 2005-06-01 03:09:59 UTC (rev 3833)
@@ -1,7 +1,4 @@
=20
-EXTRA_DIST =3D \
- vg_profile.c
-
incincdir =3D $(includedir)/valgrind
=20
incinc_HEADERS =3D \
@@ -13,6 +10,7 @@
pub_tool_hashtable.h \
pub_tool_mallocfree.h \
pub_tool_options.h \
+ pub_tool_profile.h \
pub_tool_replacemalloc.h \
pub_tool_skiplist.h \
pub_tool_stacktrace.h \
Added: trunk/include/pub_tool_profile.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_profile.h 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/include/pub_tool_profile.h 2005-06-01 03:09:59 UTC (rev 3833)
@@ -0,0 +1,92 @@
+
+/*--------------------------------------------------------------------*/
+/*--- The built-in profiler. pub_tool_profile.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_TOOL_PROFILE_H
+#define __PUB_TOOL_PROFILE_H
+
+// Define this to turn on profiling.
+//#define VG_DO_PROFILING 1
+
+/* Override the empty definitions from tool.h */
+#ifdef VG_DO_PROFILING
+# define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
+# define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
+#else
+# define VGP_PUSHCC(x)
+# define VGP_POPCC(x)
+#endif
+
+/* Nb: VG_(register_profile_event)() relies on VgpUnc being the first on=
e */
+#define VGP_CORE_LIST \
+ /* These ones depend on the core */ \
+ VGP_PAIR(VgpUnc, "unclassified"), \
+ VGP_PAIR(VgpStartup, "startup"), \
+ VGP_PAIR(VgpRun, "running"), \
+ VGP_PAIR(VgpSched, "scheduler"), \
+ VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \
+ VGP_PAIR(VgpCliMalloc, "client malloc/free"), \
+ VGP_PAIR(VgpTranslate, "translate-main"), \
+ VGP_PAIR(VgpVexTime, "Vex-time"), \
+ VGP_PAIR(VgpImprove, "improve"), \
+ VGP_PAIR(VgpESPUpdate, "ESP-update"), \
+ VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \
+ VGP_PAIR(VgpExeContext, "exe-context"), \
+ VGP_PAIR(VgpReadSyms, "read-syms"), \
+ VGP_PAIR(VgpSearchSyms, "search-syms"), \
+ VGP_PAIR(VgpAddToT, "add-to-transtab"), \
+ VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \
+ VGP_PAIR(VgpDemangle, "demangle"), \
+ VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \
+ VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \
+ /* These ones depend on the tool */ \
+ VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \
+ VGP_PAIR(VgpPostCloInit, "post-clo-init"), \
+ VGP_PAIR(VgpInstrument, "instrument"), \
+ VGP_PAIR(VgpToolSysWrap, "tool-syscall-wrapper"), \
+ VGP_PAIR(VgpToolCheapSanity, "tool-cheap-sanity"), \
+ VGP_PAIR(VgpToolExpensiveSanity, "tool-expensive-sanity"), \
+ VGP_PAIR(VgpFini, "fini")
+
+#define VGP_PAIR(n,name) n
+typedef enum { VGP_CORE_LIST } VgpCoreCC;
+#undef VGP_PAIR
+
+/* When registering tool profiling events, ensure that the 'n' value is =
in
+ * the range (VgpFini+1..) */
+extern void VG_(register_profile_event) ( Int n, Char* name );
+
+extern void VG_(pushcc) ( UInt cc );
+extern void VG_(popcc) ( UInt cc );
+
+#endif // __PUB_TOOL_PROFILE_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Modified: trunk/include/tool.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/tool.h 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/include/tool.h 2005-06-01 03:09:59 UTC (rev 3833)
@@ -97,65 +97,6 @@
=20
=20
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
-/*=3D=3D=3D Profiling =
=3D=3D=3D*/
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
-
-/* Nb: VG_(register_profile_event)() relies on VgpUnc being the first on=
e */
-#define VGP_CORE_LIST \
- /* These ones depend on the core */ \
- VGP_PAIR(VgpUnc, "unclassified"), \
- VGP_PAIR(VgpStartup, "startup"), \
- VGP_PAIR(VgpRun, "running"), \
- VGP_PAIR(VgpSched, "scheduler"), \
- VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \
- VGP_PAIR(VgpCliMalloc, "client malloc/free"), \
- VGP_PAIR(VgpTranslate, "translate-main"), \
- VGP_PAIR(VgpToUCode, "to-ucode"), \
- VGP_PAIR(VgpFromUcode, "from-ucode"), \
- VGP_PAIR(VgpImprove, "improve"), \
- VGP_PAIR(VgpESPUpdate, "ESP-update"), \
- VGP_PAIR(VgpRegAlloc, "reg-alloc"), \
- VGP_PAIR(VgpLiveness, "liveness-analysis"), \
- VGP_PAIR(VgpDoLRU, "do-lru"), \
- VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \
- VGP_PAIR(VgpExeContext, "exe-context"), \
- VGP_PAIR(VgpReadSyms, "read-syms"), \
- VGP_PAIR(VgpSearchSyms, "search-syms"), \
- VGP_PAIR(VgpAddToT, "add-to-transtab"), \
- VGP_PAIR(VgpCoreSysWrap, "core-syscall-wrapper"), \
- VGP_PAIR(VgpDemangle, "demangle"), \
- VGP_PAIR(VgpCoreCheapSanity, "core-cheap-sanity"), \
- VGP_PAIR(VgpCoreExpensiveSanity, "core-expensive-sanity"), \
- /* These ones depend on the tool */ \
- VGP_PAIR(VgpPreCloInit, "pre-clo-init"), \
- VGP_PAIR(VgpPostCloInit, "post-clo-init"), \
- VGP_PAIR(VgpInstrument, "instrument"), \
- VGP_PAIR(VgpToolSysWrap, "tool-syscall-wrapper"), \
- VGP_PAIR(VgpToolCheapSanity, "tool-cheap-sanity"), \
- VGP_PAIR(VgpToolExpensiveSanity, "tool-expensive-sanity"), \
- VGP_PAIR(VgpFini, "fini")
-
-#define VGP_PAIR(n,name) n
-typedef enum { VGP_CORE_LIST } VgpCoreCC;
-#undef VGP_PAIR
-
-/* When registering tool profiling events, ensure that the 'n' value is =
in
- * the range (VgpFini+1..) */
-extern void VG_(register_profile_event) ( Int n, Char* name );
-
-extern void VG_(pushcc) ( UInt cc );
-extern void VG_(popcc) ( UInt cc );
-
-/* Define them only if they haven't already been defined by vg_profile.c=
*/
-#ifndef VGP_PUSHCC
-# define VGP_PUSHCC(x)
-#endif
-#ifndef VGP_POPCC
-# define VGP_POPCC(x)
-#endif
-
-
-/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/*=3D=3D=3D Useful stuff to call from generated code =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
=20
Deleted: trunk/include/vg_profile.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/vg_profile.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/include/vg_profile.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -1,173 +0,0 @@
-
-/*--------------------------------------------------------------------*/
-/*--- Profiling machinery. #include this file into a tool to ---*/
-/*--- enable --profile=3Dyes, but not for release versions of tools, ---=
*/
-/*--- because it uses glibc code. ---*/
-/*--- vg_profile.c ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __VG_PROFILE_C
-#define __VG_PROFILE_C
-
-#include "tool.h"
-
-/* get rid of these, if possible */
-#include <signal.h>
-#include <sys/time.h>
-
-/* Override the empty definitions from tool.h */
-#undef VGP_PUSHCC
-#undef VGP_POPCC
-#define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
-#define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
-
-#define VGP_M_STACK 20
-#define VGP_MAX_CCS 50
-
-
-/* All zeroed initially because they're static */
-static Int vgp_nticks;
-
-static Int vgp_counts [VGP_MAX_CCS];
-static Int vgp_entries[VGP_MAX_CCS];
-static Char* vgp_names [VGP_MAX_CCS];
-
-static Int vgp_sp;
-static UInt vgp_stack[VGP_M_STACK];
-
-/* These definitions override the panicking ones in vg_profile.c */
-
-void VG_(register_profile_event) ( Int n, Char* name )
-{
- /* Adjust for negative values */
- n +=3D VgpUnc;
- if (n >=3D VGP_MAX_CCS) {
- VG_(printf)("\nProfile event #%d higher than VGP_MAX_CCS of %d.\n"
- "If you really need this many profile events, increase=
\n"
- "VGP_MAX_CCS and recompile Valgrind.\n",
- n, VGP_MAX_CCS);
- VG_(tool_panic)("profile event too high");
- }
- if (vgp_names[n] !=3D NULL) {
- VG_(printf)("\nProfile event #%d being registered as '%s'\n"
- "already registered as '%s'.\n"
- "Note that tool and core event numbers must not overla=
p.\n",
- n, name, vgp_names[n]);
- VG_(tool_panic)("profile event already registered");
- }
-
- vgp_names[n] =3D name;
-}
-
-void VG_(tick) ( int sigNo )
-{
- Int cc;
- vgp_nticks++;
- cc =3D vgp_stack[vgp_sp];
- tl_assert(cc >=3D 0 && cc < VGP_MAX_CCS);
- vgp_counts[ cc ]++;
-}
-
-void VG_(init_profiling) ( void )
-{
- struct itimerval value;
- Int ret;
-
- /* Register core events... tricky macro definition causes
- VG_(register_profile_event)() to be called once for each core even=
t
- in VGP_CORE_LIST. */
- tl_assert(VgpUnc =3D=3D 0);
-# define VGP_PAIR(n,name) VG_(register_profile_event)(n,name)
- VGP_CORE_LIST;
-# undef VGP_PAIR
-
- vgp_sp =3D -1;
- VG_(pushcc) ( VgpUnc );
-
- value.it_interval.tv_sec =3D 0;
- value.it_interval.tv_usec =3D 10 * 1000;
- value.it_value =3D value.it_interval;
-
- signal(SIGPROF, VG_(tick) );
- ret =3D setitimer(ITIMER_PROF, &value, NULL);
- if (ret !=3D 0) VG_(tool_panic)("vgp_init_profiling");
-}
-
-void VG_(done_profiling) ( void )
-{
- Int i;
- VG_(printf)("\nProfiling done, %d ticks\n", vgp_nticks);
- for (i =3D 0; i < VGP_MAX_CCS; i++)
- if (NULL !=3D vgp_names[i])
- VG_(printf)(
- "%2d: %4d (%3d %%%%) ticks, %10d entries for %s\n",
- i, vgp_counts[i],=20
- (Int)(1000.0 * (double)vgp_counts[i] / (double)vgp_nticks),
- vgp_entries[i], vgp_names[i] );
-}
-
-void VG_(pushcc) ( UInt cc )
-{
- if (vgp_sp >=3D VGP_M_STACK-1) {=20
- VG_(printf)(
- "\nMaximum profile stack depth (%d) reached for event #%d ('%s'=
).\n"
- "This is probably due to a VG_(pushcc)() without a matching\n"
- "VG_(popcc)(). Make sure they all match.\n"
- "Or if you are nesting profiling events very deeply, increase\n=
"
- "VGP_M_STACK and recompile Valgrind.\n",
- VGP_M_STACK, cc, vgp_names[cc]);
- VG_(tool_panic)("Profiling stack overflow");
- }
- vgp_sp++;
- vgp_stack[vgp_sp] =3D cc;
- vgp_entries[ cc ] ++;
-}
-
-void VG_(popcc) ( UInt cc )
-{
- if (vgp_sp <=3D 0) {
- VG_(printf)(
- "\nProfile stack underflow. This is due to a VG_(popcc)() with=
out\n"
- "a matching VG_(pushcc)(). Make sure they all match.\n");
- VG_(tool_panic)("Profiling stack underflow");
- }
- if (vgp_stack[vgp_sp] !=3D cc) {
- Int i;
- VG_(printf)("popping %s, stack looks like:\n", vgp_names[cc]);
- for (i =3D vgp_sp; i >=3D 0; i--)
- VG_(printf)("%2d: %s\n", i, vgp_names[vgp_stack[i]]);
- VG_(exit)(1);
- }
- vgp_sp--;
-}
-
-#endif /* __VG_PROFILE_C */
-
-/*--------------------------------------------------------------------*/
-/*--- end vg_profile.c ---*/
-/*--------------------------------------------------------------------*/
Modified: trunk/massif/ms_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/massif/ms_main.c 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/massif/ms_main.c 2005-06-01 03:09:59 UTC (rev 3833)
@@ -39,6 +39,7 @@
#include "pub_tool_hashtable.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
+#include "pub_tool_profile.h"
#include "pub_tool_replacemalloc.h"
#include "pub_tool_stacktrace.h"
#include "pub_tool_tooliface.h"
Modified: trunk/memcheck/mac_shared.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/mac_shared.h 2005-06-01 00:03:17 UTC (rev 3832)
+++ trunk/memcheck/mac_shared.h 2005-06-01 03:09:59 UTC (rev 3833)
@@ -40,6 +40,7 @@
#include "pub_tool_hashtable.h"
#include "pub_tool_mallocfree.h"
#include "pub_tool_options.h"
+#include "pub_tool_profile.h"
#include "pub_tool_replacemalloc.h"
#include "pub_tool_tooliface.h"
=20
|