VGP_ for platform-specific things.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3435
VG_(init_pre_mem_write) ( & ac_check_is_writable );
VG_(init_post_mem_write) ( & ac_post_mem_write );
- VGP_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
- VGP_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
- VGP_(register_profile_event) ( VgpESPAdj, "adjust-ESP" );
+ VG_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
+ VG_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
+ VG_(register_profile_event) ( VgpESPAdj, "adjust-ESP" );
init_shadow_memory();
MAC_(common_pre_clo_init)();
cachesim_D1_initcache(D1c);
cachesim_L2_initcache(L2c);
- VGP_(register_profile_event)(VgpGetLineCC, "get-lineCC");
- VGP_(register_profile_event)(VgpCacheSimulate, "cache-simulate");
- VGP_(register_profile_event)(VgpCacheResults, "cache-results");
+ VG_(register_profile_event)(VgpGetLineCC, "get-lineCC");
+ VG_(register_profile_event)(VgpCacheSimulate, "cache-simulate");
+ VG_(register_profile_event)(VgpCacheResults, "cache-results");
}
VG_DETERMINE_INTERFACE_VERSION(TL_(pre_clo_init), 0)
Profiling stuff
------------------------------------------------------------------ */
-extern void VGP_(init_profiling) ( void );
-extern void VGP_(done_profiling) ( void );
+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)) VGP_(pushcc)(x)
-#define VGP_POPCC(x) if (VG_(clo_profile)) VGP_(popcc)(x)
+#define VGP_PUSHCC(x) if (VG_(clo_profile)) VG_(pushcc)(x)
+#define VGP_POPCC(x) if (VG_(clo_profile)) VG_(popcc)(x)
/* ---------------------------------------------------------------------
VG_(exit)(1);
}
-void VGP_(register_profile_event) ( Int n, Char* name )
+void VG_(register_profile_event) ( Int n, Char* name )
{
}
-void VGP_(init_profiling) ( void )
+void VG_(init_profiling) ( void )
{
vgp_die();
}
-void VGP_(done_profiling) ( void )
+void VG_(done_profiling) ( void )
{
VG_(core_panic)("done_profiling(), but not compiled for profiling??");
}
-void VGP_(pushcc) ( UInt cc )
+void VG_(pushcc) ( UInt cc )
{
vgp_die();
}
-void VGP_(popcc) ( UInt cc )
+void VG_(popcc) ( UInt cc )
{
vgp_die();
}
// in pre_process_cmd_line_options() could get it earlier.
//--------------------------------------------------------------
if (VG_(clo_profile))
- VGP_(init_profiling)();
+ VG_(init_profiling)();
VGP_PUSHCC(VgpStartup);
print_all_stats();
if (VG_(clo_profile))
- VGP_(done_profiling)();
+ VG_(done_profiling)();
if (VG_(clo_profile_flags) > 0)
VG_(show_BB_profile)();
<sect2 id="writing-tools.profiling" xreflabel="Profiling">
<title>Profiling</title>
+<para>Nb: as of 25-Mar-2005, the profiling is broken, and has been
+for a long time...</para>
+
<para>To do simple tick-based profiling of a tool, include the
line:</para>
<programlisting><![CDATA[
<para>The profiler is stack-based; you can register a profiling
event with
-<computeroutput>VGP_(register_profile_event)()</computeroutput>
+<computeroutput>VG_(register_profile_event)()</computeroutput>
and then use the <computeroutput>VGP_PUSHCC</computeroutput> and
<computeroutput>VGP_POPCC</computeroutput> macros to record time
spent doing certain things. New profiling event numbers must not
/*=== Profiling ===*/
/*====================================================================*/
-/* Nb: VGP_(register_profile_event)() relies on VgpUnc being the first one */
+/* Nb: VG_(register_profile_event)() relies on VgpUnc being the first one */
#define VGP_CORE_LIST \
/* These ones depend on the core */ \
VGP_PAIR(VgpUnc, "unclassified"), \
/* When registering tool profiling events, ensure that the 'n' value is in
* the range (VgpFini+1..) */
-extern void VGP_(register_profile_event) ( Int n, Char* name );
+extern void VG_(register_profile_event) ( Int n, Char* name );
-extern void VGP_(pushcc) ( UInt cc );
-extern void VGP_(popcc) ( UInt cc );
+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
/* These macros should add different prefixes so the same base
name can safely be used across different macros. */
#define VG_(str) VGAPPEND(vgPlain_,str)
-#define VGP_(str) VGAPPEND(vgProf_,str)
#define VGA_(str) VGAPPEND(vgArch_,str)
+#define VGO_(str) VGAPPEND(vgOS,str)
+#define VGP_(str) VGAPPEND(vgPlatform,str)
/* Tool-specific ones. Note that final name still starts with "vg". */
#define TL_(str) VGAPPEND(vgTool_,str)
/* Override the empty definitions from tool.h */
#undef VGP_PUSHCC
#undef VGP_POPCC
-#define VGP_PUSHCC(x) if (VG_(clo_profile)) VGP_(pushcc)(x)
-#define VGP_POPCC(x) if (VG_(clo_profile)) VGP_(popcc)(x)
+#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
/* These definitions override the panicking ones in vg_profile.c */
-void VGP_(register_profile_event) ( Int n, Char* name )
+void VG_(register_profile_event) ( Int n, Char* name )
{
/* Adjust for negative values */
n += VgpUnc;
vgp_names[n] = name;
}
-void VGP_(tick) ( int sigNo )
+void VG_(tick) ( int sigNo )
{
Int cc;
vgp_nticks++;
vgp_counts[ cc ]++;
}
-void VGP_(init_profiling) ( void )
+void VG_(init_profiling) ( void )
{
struct itimerval value;
Int ret;
/* Register core events... tricky macro definition causes
- VGP_(register_profile_event)() to be called once for each core event
+ VG_(register_profile_event)() to be called once for each core event
in VGP_CORE_LIST. */
tl_assert(VgpUnc == 0);
-# define VGP_PAIR(n,name) VGP_(register_profile_event)(n,name)
+# define VGP_PAIR(n,name) VG_(register_profile_event)(n,name)
VGP_CORE_LIST;
# undef VGP_PAIR
vgp_sp = -1;
- VGP_(pushcc) ( VgpUnc );
+ VG_(pushcc) ( VgpUnc );
value.it_interval.tv_sec = 0;
value.it_interval.tv_usec = 10 * 1000;
value.it_value = value.it_interval;
- signal(SIGPROF, VGP_(tick) );
+ signal(SIGPROF, VG_(tick) );
ret = setitimer(ITIMER_PROF, &value, NULL);
if (ret != 0) VG_(tool_panic)("vgp_init_profiling");
}
-void VGP_(done_profiling) ( void )
+void VG_(done_profiling) ( void )
{
Int i;
VG_(printf)("\nProfiling done, %d ticks\n", vgp_nticks);
vgp_entries[i], vgp_names[i] );
}
-void VGP_(pushcc) ( UInt cc )
+void VG_(pushcc) ( UInt cc )
{
if (vgp_sp >= VGP_M_STACK-1) {
VG_(printf)(
"\nMaximum profile stack depth (%d) reached for event #%d (`%s').\n"
- "This is probably due to a VGP_(pushcc)() without a matching\n"
- "VGP_(popcc)(). Make sure they all match.\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]);
vgp_entries[ cc ] ++;
}
-void VGP_(popcc) ( UInt cc )
+void VG_(popcc) ( UInt cc )
{
if (vgp_sp <= 0) {
VG_(printf)(
- "\nProfile stack underflow. This is due to a VGP_(popcc)() without\n"
- "a matching VGP_(pushcc)(). Make sure they all match.\n");
+ "\nProfile stack underflow. This is due to a VG_(popcc)() without\n"
+ "a matching VG_(pushcc)(). Make sure they all match.\n");
VG_(tool_panic)("Profiling stack underflow");
}
if (vgp_stack[vgp_sp] != cc) {
VG_(init_die_mem_stack_signal) ( die_mem_stack_signal );
// Profiling events
- VGP_(register_profile_event)(VgpGetXPt, "get-XPt");
- VGP_(register_profile_event)(VgpGetXPtSearch, "get-XPt-search");
- VGP_(register_profile_event)(VgpCensus, "census");
- VGP_(register_profile_event)(VgpCensusHeap, "census-heap");
- VGP_(register_profile_event)(VgpCensusSnapshot, "census-snapshot");
- VGP_(register_profile_event)(VgpCensusTreeSize, "census-treesize");
- VGP_(register_profile_event)(VgpUpdateXCon, "update-XCon");
- VGP_(register_profile_event)(VgpCalcSpacetime2, "calc-exact_ST_dbld");
- VGP_(register_profile_event)(VgpPrintHp, "print-hp");
- VGP_(register_profile_event)(VgpPrintXPts, "print-XPts");
+ VG_(register_profile_event)(VgpGetXPt, "get-XPt");
+ VG_(register_profile_event)(VgpGetXPtSearch, "get-XPt-search");
+ VG_(register_profile_event)(VgpCensus, "census");
+ VG_(register_profile_event)(VgpCensusHeap, "census-heap");
+ VG_(register_profile_event)(VgpCensusSnapshot, "census-snapshot");
+ VG_(register_profile_event)(VgpCensusTreeSize, "census-treesize");
+ VG_(register_profile_event)(VgpUpdateXCon, "update-XCon");
+ VG_(register_profile_event)(VgpCalcSpacetime2, "calc-exact_ST_dbld");
+ VG_(register_profile_event)(VgpPrintHp, "print-hp");
+ VG_(register_profile_event)(VgpPrintXPts, "print-XPts");
// HP_Chunks
malloc_list = VG_(HT_construct)();
VG_(init_post_reg_write) ( & mc_post_reg_write );
VG_(init_post_reg_write_clientcall_return) ( & mc_post_reg_write_clientcall );
- VGP_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
- VGP_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
- VGP_(register_profile_event) ( VgpESPAdj, "adjust-ESP" );
+ VG_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
+ VG_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
+ VG_(register_profile_event) ( VgpESPAdj, "adjust-ESP" );
/* Additional block description for VG_(describe_addr)() */
MAC_(describe_addr_supp) = client_perm_maybe_describe;