From: Nicholas Nethercote Date: Sat, 26 Mar 2005 00:42:02 +0000 (+0000) Subject: Don't use the VGP_ for profiling any more, just use VG_ -- we want to use X-Git-Tag: svn/VALGRIND_3_0_0~883 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27066dbfc5dd558c1e98b9829f82845e1d04f9ab;p=thirdparty%2Fvalgrind.git Don't use the VGP_ for profiling any more, just use VG_ -- we want to use VGP_ for platform-specific things. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3435 --- diff --git a/addrcheck/ac_main.c b/addrcheck/ac_main.c index bcb937a594..7ed3de10c1 100644 --- a/addrcheck/ac_main.c +++ b/addrcheck/ac_main.c @@ -1364,9 +1364,9 @@ void TL_(pre_clo_init)(void) 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)(); diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 159051b3de..4e625fd8aa 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -1135,9 +1135,9 @@ void TL_(post_clo_init)(void) 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) diff --git a/coregrind/core.h b/coregrind/core.h index 37b5a61bbd..16000413fd 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -283,13 +283,13 @@ extern Bool VGA_(client_requests)(ThreadId tid, UWord *args); 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) /* --------------------------------------------------------------------- diff --git a/coregrind/vg_dummy_profile.c b/coregrind/vg_dummy_profile.c index 2125e6922d..6bc2ea2de1 100644 --- a/coregrind/vg_dummy_profile.c +++ b/coregrind/vg_dummy_profile.c @@ -42,26 +42,26 @@ static void vgp_die(void) 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(); } diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 59389a567f..31c465b32b 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -2738,7 +2738,7 @@ int main(int argc, char **argv, char **envp) // in pre_process_cmd_line_options() could get it earlier. //-------------------------------------------------------------- if (VG_(clo_profile)) - VGP_(init_profiling)(); + VG_(init_profiling)(); VGP_PUSHCC(VgpStartup); @@ -2836,7 +2836,7 @@ void VG_(shutdown_actions)(ThreadId tid) print_all_stats(); if (VG_(clo_profile)) - VGP_(done_profiling)(); + VG_(done_profiling)(); if (VG_(clo_profile_flags) > 0) VG_(show_BB_profile)(); diff --git a/docs/xml/writing-tools.xml b/docs/xml/writing-tools.xml index aaf1d9b2b4..8915a3632b 100644 --- a/docs/xml/writing-tools.xml +++ b/docs/xml/writing-tools.xml @@ -1120,6 +1120,9 @@ want to write regression tests for your tool: Profiling +Nb: as of 25-Mar-2005, the profiling is broken, and has been +for a long time... + To do simple tick-based profiling of a tool, include the line: The profiler is stack-based; you can register a profiling event with -VGP_(register_profile_event)() +VG_(register_profile_event)() and then use the VGP_PUSHCC and VGP_POPCC macros to record time spent doing certain things. New profiling event numbers must not diff --git a/include/tool.h.base b/include/tool.h.base index 14d9fe61eb..f4f34c799d 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -203,7 +203,7 @@ extern int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs ) /*=== 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"), \ @@ -244,10 +244,10 @@ typedef enum { VGP_CORE_LIST } VgpCoreCC; /* 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 diff --git a/include/tool_asm.h b/include/tool_asm.h index 931abc63b7..65c2d5ecf8 100644 --- a/include/tool_asm.h +++ b/include/tool_asm.h @@ -41,8 +41,9 @@ /* 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) diff --git a/include/vg_profile.c b/include/vg_profile.c index 6ee6f687a8..88030db388 100644 --- a/include/vg_profile.c +++ b/include/vg_profile.c @@ -43,8 +43,8 @@ /* 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 @@ -62,7 +62,7 @@ static UInt vgp_stack[VGP_M_STACK]; /* 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; @@ -84,7 +84,7 @@ void VGP_(register_profile_event) ( Int n, Char* name ) vgp_names[n] = name; } -void VGP_(tick) ( int sigNo ) +void VG_(tick) ( int sigNo ) { Int cc; vgp_nticks++; @@ -93,32 +93,32 @@ void VGP_(tick) ( int sigNo ) 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); @@ -131,13 +131,13 @@ void VGP_(done_profiling) ( void ) 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]); @@ -148,12 +148,12 @@ void VGP_(pushcc) ( UInt 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) { diff --git a/massif/ms_main.c b/massif/ms_main.c index 019f4ae385..6b4661c371 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -1179,16 +1179,16 @@ void TL_(pre_clo_init)() 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)(); diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 4654251012..eb2fd350a0 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -1925,9 +1925,9 @@ void TL_(pre_clo_init)(void) 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;