diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2005-12-19 22:48:39 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2005-12-19 22:48:39 +0000 |
commit | bcd75fcb80c13b9828a4c33b0d7acf1499e14135 (patch) | |
tree | 9285fbd9354e153b08e9bc81ca77ca7779c9e847 | |
parent | 13a49267f232b09c9b4a8edd01b2ac1b9d0724b9 (diff) |
Remove all remaining profiling gunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5388 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | addrcheck/ac_main.c | 26 | ||||
-rw-r--r-- | cachegrind/cg_main.c | 37 | ||||
-rw-r--r-- | coregrind/Makefile.am | 2 | ||||
-rw-r--r-- | coregrind/m_debuginfo/symtab.c | 17 | ||||
-rw-r--r-- | coregrind/m_demangle/demangle.c | 5 | ||||
-rw-r--r-- | coregrind/m_execontext.c | 5 | ||||
-rw-r--r-- | coregrind/m_main.c | 25 | ||||
-rw-r--r-- | coregrind/m_mallocfree.c | 21 | ||||
-rw-r--r-- | coregrind/m_options.c | 1 | ||||
-rw-r--r-- | coregrind/m_profile.c | 171 | ||||
-rw-r--r-- | coregrind/m_scheduler/scheduler.c | 20 | ||||
-rw-r--r-- | coregrind/m_stacktrace.c | 5 | ||||
-rw-r--r-- | coregrind/m_translate.c | 10 | ||||
-rw-r--r-- | coregrind/pub_core_profile.h | 50 | ||||
-rw-r--r-- | docs/xml/writing-tools.xml | 4 | ||||
-rw-r--r-- | helgrind/hg_main.c | 5 | ||||
-rw-r--r-- | include/Makefile.am | 1 | ||||
-rw-r--r-- | include/pub_tool_options.h | 3 | ||||
-rw-r--r-- | include/pub_tool_profile.h | 91 | ||||
-rw-r--r-- | massif/ms_main.c | 80 | ||||
-rw-r--r-- | none/tests/cmdline2.stdout.exp | 1 |
21 files changed, 2 insertions, 578 deletions
diff --git a/addrcheck/ac_main.c b/addrcheck/ac_main.c index 0b2fbb89..d62a7594 100644 --- a/addrcheck/ac_main.c +++ b/addrcheck/ac_main.c @@ -35,7 +35,6 @@ #include "pub_tool_libcbase.h" #include "pub_tool_libcassert.h" #include "pub_tool_libcprint.h" -#include "pub_tool_profile.h" // For mac_shared.h #include "pub_tool_tooliface.h" #include "pub_tool_threadstate.h" @@ -290,8 +289,6 @@ void set_address_range_perms ( Addr a, SizeT len, UInt example_a_bit ) len, example_a_bit ); } - VGP_PUSHCC(VgpSetMem); - /* Requests to change permissions of huge address ranges may indicate bugs in our machinery. 30,000,000 is arbitrary, but so far all legitimate requests have fallen beneath that size. */ @@ -329,7 +326,6 @@ void set_address_range_perms ( Addr a, SizeT len, UInt example_a_bit ) } if (len == 0) { - VGP_POPCC(VgpSetMem); return; } tl_assert((a % 8) == 0 && len > 0); @@ -389,8 +385,6 @@ void set_address_range_perms ( Addr a, SizeT len, UInt example_a_bit ) len--; } # endif - - VGP_POPCC(VgpSetMem); } /* Set permissions for address ranges ... */ @@ -416,7 +410,6 @@ void make_aligned_word_noaccess(Addr a) UInt sm_off; UChar mask; - VGP_PUSHCC(VgpESPAdj); ENSURE_MAPPABLE(a, "make_aligned_word_noaccess"); sm = primary_map[PM_IDX(a)]; sm_off = SM_OFF(a); @@ -424,7 +417,6 @@ void make_aligned_word_noaccess(Addr a) mask <<= (a & 4 /* 100b */); /* a & 4 is either 0 or 4 */ /* mask now contains 1s where we wish to make address bits invalid (1s). */ sm->abits[sm_off >> 3] |= mask; - VGP_POPCC(VgpESPAdj); } static __inline__ @@ -434,7 +426,6 @@ void make_aligned_word_accessible(Addr a) UInt sm_off; UChar mask; - VGP_PUSHCC(VgpESPAdj); ENSURE_MAPPABLE(a, "make_aligned_word_accessible"); sm = primary_map[PM_IDX(a)]; sm_off = SM_OFF(a); @@ -443,7 +434,6 @@ void make_aligned_word_accessible(Addr a) /* mask now contains 1s where we wish to make address bits invalid (0s). */ sm->abits[sm_off >> 3] &= ~mask; - VGP_POPCC(VgpESPAdj); } /* Nb: by "aligned" here we mean 8-byte aligned */ @@ -453,12 +443,10 @@ void make_aligned_doubleword_accessible(Addr a) AcSecMap* sm; UInt sm_off; - VGP_PUSHCC(VgpESPAdj); ENSURE_MAPPABLE(a, "make_aligned_doubleword_accessible"); sm = primary_map[PM_IDX(a)]; sm_off = SM_OFF(a); sm->abits[sm_off >> 3] = VGM_BYTE_VALID; - VGP_POPCC(VgpESPAdj); } static __inline__ @@ -467,12 +455,10 @@ void make_aligned_doubleword_noaccess(Addr a) AcSecMap* sm; UInt sm_off; - VGP_PUSHCC(VgpESPAdj); ENSURE_MAPPABLE(a, "make_aligned_doubleword_noaccess"); sm = primary_map[PM_IDX(a)]; sm_off = SM_OFF(a); sm->abits[sm_off >> 3] = VGM_BYTE_INVALID; - VGP_POPCC(VgpESPAdj); } /* The %esp update handling functions */ @@ -578,8 +564,6 @@ void ac_check_is_accessible ( CorePart part, ThreadId tid, Bool ok; Addr bad_addr = 0; // Initialise to shut gcc up - VGP_PUSHCC(VgpCheckMem); - ok = ac_check_accessible ( base, size, &bad_addr ); if (!ok) { switch (part) { @@ -606,8 +590,6 @@ void ac_check_is_accessible ( CorePart part, ThreadId tid, VG_(tool_panic)("ac_check_is_accessible: unexpected CorePart"); } } - - VGP_POPCC(VgpCheckMem); } static @@ -631,16 +613,12 @@ void ac_check_is_readable_asciiz ( CorePart part, ThreadId tid, Bool ok = True; Addr bad_addr = 0; // Initialise to shut gcc up - VGP_PUSHCC(VgpCheckMem); - tl_assert(part == Vg_CoreSysCall); ok = ac_check_readable_asciiz ( (Addr)str, &bad_addr ); if (!ok) { MAC_(record_param_error) ( tid, bad_addr, /*IsReg*/False, /*IsUnaddr*/True, s ); } - - VGP_POPCC(VgpCheckMem); } static @@ -1427,10 +1405,6 @@ static void ac_pre_clo_init(void) VG_(track_pre_mem_write) ( & ac_check_is_writable ); VG_(track_post_mem_write) ( & ac_post_mem_write ); - 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)(); #endif diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 3c9627e1..a1142ced 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -40,7 +40,6 @@ #include "pub_tool_mallocfree.h" #include "pub_tool_options.h" #include "pub_tool_oset.h" -#include "pub_tool_profile.h" #include "pub_tool_tooliface.h" #include "pub_tool_clientstate.h" @@ -59,18 +58,6 @@ #define FN_LEN 256 /*------------------------------------------------------------*/ -/*--- Profiling events ---*/ -/*------------------------------------------------------------*/ - -typedef - enum { - VgpGetLineCC = VgpFini+1, - VgpCacheSimulate, - VgpCacheResults - } - VgpToolCC; - -/*------------------------------------------------------------*/ /*--- Types and Data Structures ---*/ /*------------------------------------------------------------*/ @@ -236,8 +223,6 @@ static LineCC* get_lineCC(Addr origAddr) get_debug_info(origAddr, file, fn, &line); - VGP_PUSHCC(VgpGetLineCC); - loc.file = file; loc.fn = fn; loc.line = line; @@ -252,7 +237,6 @@ static LineCC* get_lineCC(Addr origAddr) VG_(OSet_Insert)(CC_table, lineCC); } - VGP_POPCC(VgpGetLineCC); return lineCC; } @@ -265,11 +249,9 @@ void log_1I_0D_cache_access(InstrInfo* n) { //VG_(printf)("1I_0D : CCaddr=0x%010lx, iaddr=0x%010lx, isize=%lu\n", // n, n->instr_addr, n->instr_len); - VGP_PUSHCC(VgpCacheSimulate); cachesim_I1_doref(n->instr_addr, n->instr_len, &n->parent->Ir.m1, &n->parent->Ir.m2); n->parent->Ir.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(2) @@ -279,14 +261,12 @@ void log_2I_0D_cache_access(InstrInfo* n, InstrInfo* n2) // " CC2addr=0x%010lx, i2addr=0x%010lx, i2size=%lu\n", // n, n->instr_addr, n->instr_len, // n2, n2->instr_addr, n2->instr_len); - VGP_PUSHCC(VgpCacheSimulate); cachesim_I1_doref(n->instr_addr, n->instr_len, &n->parent->Ir.m1, &n->parent->Ir.m2); n->parent->Ir.a++; cachesim_I1_doref(n2->instr_addr, n2->instr_len, &n2->parent->Ir.m1, &n2->parent->Ir.m2); n2->parent->Ir.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(3) @@ -298,7 +278,6 @@ void log_3I_0D_cache_access(InstrInfo* n, InstrInfo* n2, InstrInfo* n3) // n, n->instr_addr, n->instr_len, // n2, n2->instr_addr, n2->instr_len, // n3, n3->instr_addr, n3->instr_len); - VGP_PUSHCC(VgpCacheSimulate); cachesim_I1_doref(n->instr_addr, n->instr_len, &n->parent->Ir.m1, &n->parent->Ir.m2); n->parent->Ir.a++; @@ -308,7 +287,6 @@ void log_3I_0D_cache_access(InstrInfo* n, InstrInfo* n2, InstrInfo* n3) cachesim_I1_doref(n3->instr_addr, n3->instr_len, &n3->parent->Ir.m1, &n3->parent->Ir.m2); n3->parent->Ir.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(3) @@ -317,7 +295,6 @@ void log_1I_1Dr_cache_access(InstrInfo* n, Addr data_addr, Word data_size) //VG_(printf)("1I_1Dr: CCaddr=0x%010lx, iaddr=0x%010lx, isize=%lu\n" // " daddr=0x%010lx, dsize=%lu\n", // n, n->instr_addr, n->instr_len, data_addr, data_size); - VGP_PUSHCC(VgpCacheSimulate); cachesim_I1_doref(n->instr_addr, n->instr_len, &n->parent->Ir.m1, &n->parent->Ir.m2); n->parent->Ir.a++; @@ -325,7 +302,6 @@ void log_1I_1Dr_cache_access(InstrInfo* n, Addr data_addr, Word data_size) cachesim_D1_doref(data_addr, data_size, &n->parent->Dr.m1, &n->parent->Dr.m2); n->parent->Dr.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(3) @@ -334,7 +310,6 @@ void log_1I_1Dw_cache_access(InstrInfo* n, Addr data_addr, Word data_size) //VG_(printf)("1I_1Dw: CCaddr=0x%010lx, iaddr=0x%010lx, isize=%lu\n" // " daddr=0x%010lx, dsize=%lu\n", // n, n->instr_addr, n->instr_len, data_addr, data_size); - VGP_PUSHCC(VgpCacheSimulate); cachesim_I1_doref(n->instr_addr, n->instr_len, &n->parent->Ir.m1, &n->parent->Ir.m2); n->parent->Ir.a++; @@ -342,7 +317,6 @@ void log_1I_1Dw_cache_access(InstrInfo* n, Addr data_addr, Word data_size) cachesim_D1_doref(data_addr, data_size, &n->parent->Dw.m1, &n->parent->Dw.m2); n->parent->Dw.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(3) @@ -350,11 +324,9 @@ void log_0I_1Dr_cache_access(InstrInfo* n, Addr data_addr, Word data_size) { //VG_(printf)("0I_1Dr: CCaddr=0x%010lx, daddr=0x%010lx, dsize=%lu\n", // n, data_addr, data_size); - VGP_PUSHCC(VgpCacheSimulate); cachesim_D1_doref(data_addr, data_size, &n->parent->Dr.m1, &n->parent->Dr.m2); n->parent->Dr.a++; - VGP_POPCC(VgpCacheSimulate); } static VG_REGPARM(3) @@ -362,11 +334,9 @@ void log_0I_1Dw_cache_access(InstrInfo* n, Addr data_addr, Word data_size) { //VG_(printf)("0I_1Dw: CCaddr=0x%010lx, daddr=0x%010lx, dsize=%lu\n", // n, data_addr, data_size); - VGP_PUSHCC(VgpCacheSimulate); cachesim_D1_doref(data_addr, data_size, &n->parent->Dw.m1, &n->parent->Dw.m2); n->parent->Dw.a++; - VGP_POPCC(VgpCacheSimulate); } /*------------------------------------------------------------*/ @@ -1013,8 +983,6 @@ static void fprint_CC_table_and_calc_totals(void) Char buf[512], *currFile = NULL, *currFn = NULL; LineCC* lineCC; - VGP_PUSHCC(VgpCacheResults); - sres = VG_(open)(cachegrind_out_file, VKI_O_CREAT|VKI_O_TRUNC|VKI_O_WRONLY, VKI_S_IRUSR|VKI_S_IWUSR); if (sres.isError) { @@ -1245,7 +1213,6 @@ static void cg_fini(Int exitcode) VG_(message)(Vg_DebugMsg, "cachegrind: InstrInfo table size: %u", VG_(OSet_Size)(instrInfoTable)); } - VGP_POPCC(VgpCacheResults); } /*--------------------------------------------------------------------*/ @@ -1355,10 +1322,6 @@ static void cg_post_clo_init(void) cachesim_I1_initcache(I1c); cachesim_D1_initcache(D1c); cachesim_L2_initcache(L2c); - - VG_(register_profile_event)(VgpGetLineCC, "get-lineCC"); - VG_(register_profile_event)(VgpCacheSimulate, "cache-simulate"); - VG_(register_profile_event)(VgpCacheResults, "cache-results"); } static Char base_dir[VKI_PATH_MAX]; diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index b61ab26a..9002f0e5 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -75,7 +75,6 @@ noinst_HEADERS = \ pub_core_mallocfree.h \ pub_core_options.h \ pub_core_oset.h \ - pub_core_profile.h \ pub_core_pthreadmodel.h \ pub_core_redir.h \ pub_core_replacemalloc.h\ @@ -139,7 +138,6 @@ COREGRIND_SOURCES_COMMON = \ m_mallocfree.c \ m_options.c \ m_oset.c \ - m_profile.c \ m_pthreadmodel.c \ m_redir.c \ m_signals.c \ diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c index 0afe0d86..b1de9b5f 100644 --- a/coregrind/m_debuginfo/symtab.c +++ b/coregrind/m_debuginfo/symtab.c @@ -40,7 +40,6 @@ #include "pub_core_machine.h" #include "pub_core_mallocfree.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_redir.h" #include "pub_core_tooliface.h" // For VG_(needs).data_syms @@ -1780,8 +1779,6 @@ SegInfo *VG_(read_seg_symbols) ( Addr seg_addr, SizeT seg_len, { SegInfo* si = alloc_SegInfo(seg_addr, seg_len, seg_offset, seg_filename); - VGP_PUSHCC(VgpReadSyms); - if (!read_lib_symbols ( si )) { // Something went wrong (eg. bad ELF file). freeSegInfo( si ); @@ -1800,7 +1797,6 @@ SegInfo *VG_(read_seg_symbols) ( Addr seg_addr, SizeT seg_len, /* do redirects */ VG_(resolve_existing_redirs_with_seginfo)( si ); } - VGP_POPCC(VgpReadSyms); return si; } @@ -1835,7 +1831,6 @@ static void unload_symbols ( Addr start, SizeT length ) } // Not found. - VGP_POPCC(VgpReadSyms); } /*------------------------------------------------------------*/ @@ -1899,21 +1894,17 @@ static void search_all_symtabs ( Addr ptr, /*OUT*/SegInfo** psi, Int sno; SegInfo* si; - VGP_PUSHCC(VgpSearchSyms); - for (si = segInfo_list; si != NULL; si = si->next) { if (si->start <= ptr && ptr < si->start+si->size) { sno = search_one_symtab ( si, ptr, match_anywhere_in_fun ); if (sno == -1) goto not_found; *symno = sno; *psi = si; - VGP_POPCC(VgpSearchSyms); return; } } not_found: *psi = NULL; - VGP_POPCC(VgpSearchSyms); } @@ -1951,21 +1942,17 @@ static void search_all_loctabs ( Addr ptr, /*OUT*/SegInfo** psi, Int lno; SegInfo* si; - VGP_PUSHCC(VgpSearchSyms); - for (si = segInfo_list; si != NULL; si = si->next) { if (si->start <= ptr && ptr < si->start+si->size) { lno = search_one_loctab ( si, ptr ); if (lno == -1) goto not_found; *locno = lno; *psi = si; - VGP_POPCC(VgpSearchSyms); return; } } not_found: *psi = NULL; - VGP_POPCC(VgpSearchSyms); } @@ -2004,21 +1991,17 @@ static void search_all_scopetabs ( Addr ptr, Int scno; SegInfo* si; - VGP_PUSHCC(VgpSearchSyms); - for (si = segInfo_list; si != NULL; si = si->next) { if (si->start <= ptr && ptr < si->start+si->size) { scno = search_one_scopetab ( si, ptr ); if (scno == -1) goto not_found; *scopeno = scno; *psi = si; - VGP_POPCC(VgpSearchSyms); return; } } not_found: *psi = NULL; - VGP_POPCC(VgpSearchSyms); } diff --git a/coregrind/m_demangle/demangle.c b/coregrind/m_demangle/demangle.c index 82f8e180..430d0c83 100644 --- a/coregrind/m_demangle/demangle.c +++ b/coregrind/m_demangle/demangle.c @@ -33,15 +33,12 @@ #include "pub_core_libcbase.h" #include "pub_core_mallocfree.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "demangle.h" void VG_(demangle) ( Char* orig, Char* result, Int result_size ) { Char* demangled = NULL; - VGP_PUSHCC(VgpDemangle); - if (VG_(clo_demangle)) demangled = VG_(cplus_demangle) ( orig, DMGL_ANSI | DMGL_PARAMS ); @@ -57,8 +54,6 @@ void VG_(demangle) ( Char* orig, Char* result, Int result_size ) // very rarely (ie. I've heard of it twice in 3 years), the demangler // does leak. But, we can't do much about it, and it's not a disaster, // so we just let it slide without aborting or telling the user. - - VGP_POPCC(VgpDemangle); } /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index a4ed1216..c5b5c939 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -34,7 +34,6 @@ #include "pub_core_libcprint.h" // For VG_(message)() #include "pub_core_mallocfree.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_stacktrace.h" /*------------------------------------------------------------*/ @@ -190,8 +189,6 @@ ExeContext* VG_(record_ExeContext) ( ThreadId tid ) ExeContext* new_ec; ExeContext* list; - VGP_PUSHCC(VgpExeContext); - init_ExeContext_storage(); vg_assert(VG_(clo_backtrace_size) >= 1 && VG_(clo_backtrace_size) <= VG_DEEPEST_BACKTRACE); @@ -230,7 +227,6 @@ ExeContext* VG_(record_ExeContext) ( ThreadId tid ) if (list != NULL) { /* Yay! We found it. */ - VGP_POPCC(VgpExeContext); return list; } @@ -247,7 +243,6 @@ ExeContext* VG_(record_ExeContext) ( ThreadId tid ) new_ec->next = ec_list[hash]; ec_list[hash] = new_ec; - VGP_POPCC(VgpExeContext); return new_ec; } diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 29273299..97ba2d9a 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -46,7 +46,6 @@ #include "pub_core_machine.h" #include "pub_core_mallocfree.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_debuginfo.h" #include "pub_core_redir.h" #include "pub_core_scheduler.h" @@ -912,7 +911,6 @@ static void usage_NORETURN ( Bool debug_help ) "\n" " debugging options for all Valgrind tools:\n" " --sanity-level=<number> level of sanity checking to do [1]\n" -" --profile=no|yes profile? (tool must be built for it) [no]\n" " --trace-flags=<XXXXXXXX> show generated code? (X = 0|1) [00000000]\n" " --profile-flags=<XXXXXXXX> ditto, but for profiling (X = 0|1) [00000000]\n" " --trace-notbelow=<number> only show BBs above <number> [0]\n" @@ -1100,7 +1098,6 @@ static Bool process_cmd_line_options( UInt* client_auxv, const char* toolname ) else VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit)) else VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) else VG_NUM_CLO (arg, "--max-stackframe", VG_(clo_max_stackframe)) - else VG_BOOL_CLO(arg, "--profile", VG_(clo_profile)) else VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) else VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main)) else VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp)) @@ -2506,23 +2503,6 @@ Int main(Int argc, HChar **argv, HChar **envp) VG_(sigstartup_actions)(); //-------------------------------------------------------------- - // Perhaps we're profiling Valgrind? - // p: process_cmd_line_options() [for VG_(clo_profile)] - // p: others? - // - // XXX: this seems to be broken? It always says the tool wasn't built - // for profiling; vg_profile.c's functions don't seem to be overriding - // vg_dummy_profile.c's? - // - // XXX: want this as early as possible. Looking for --profile - // in get_helprequest_and_toolname() could get it earlier. - //-------------------------------------------------------------- - if (VG_(clo_profile)) - VG_(init_profiling)(); - - VGP_PUSHCC(VgpStartup); - - //-------------------------------------------------------------- // Read suppression file // p: process_cmd_line_options() [for VG_(clo_suppressions)] //-------------------------------------------------------------- @@ -2548,8 +2528,6 @@ Int main(Int argc, HChar **argv, HChar **envp) //-------------------------------------------------------------- // Run! //-------------------------------------------------------------- - VGP_POPCC(VgpStartup); - if (VG_(clo_xml)) { HChar buf[50]; VG_(elapsed_wallclock_time)(buf); @@ -2652,9 +2630,6 @@ void shutdown_actions_NORETURN( ThreadId tid, if (VG_(clo_verbosity) > 1) print_all_stats(); - if (VG_(clo_profile)) - VG_(done_profiling)(); - if (VG_(clo_profile_flags) > 0) { #define N_MAX 100 BBProfEntry tops[N_MAX]; diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 0fd5e9fd..98d03a9a 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -37,7 +37,6 @@ #include "pub_core_libcprint.h" #include "pub_core_mallocfree.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_tooliface.h" #include "valgrind.h" @@ -997,8 +996,6 @@ void* VG_(arena_malloc) ( ArenaId aid, SizeT req_pszB ) Arena* a; void* v; - VGP_PUSHCC(VgpMalloc); - ensure_mm_init(aid); a = arenaId_to_ArenaP(aid); @@ -1070,7 +1067,6 @@ void* VG_(arena_malloc) ( ArenaId aid, SizeT req_pszB ) sanity_check_malloc_arena(aid); # endif - VGP_POPCC(VgpMalloc); v = get_block_payload(a, b); vg_assert( (((Addr)v) & (VG_MIN_MALLOC_SZB-1)) == 0 ); @@ -1090,13 +1086,10 @@ void VG_(arena_free) ( ArenaId aid, void* ptr ) UInt b_listno; Arena* a; - VGP_PUSHCC(VgpMalloc); - ensure_mm_init(aid); a = arenaId_to_ArenaP(aid); if (ptr == NULL) { - VGP_POPCC(VgpMalloc); return; } @@ -1179,8 +1172,6 @@ void VG_(arena_free) ( ArenaId aid, void* ptr ) # endif //zzVALGRIND_FREELIKE_BLOCK(ptr, 0); - - VGP_POPCC(VgpMalloc); } @@ -1224,8 +1215,6 @@ void* VG_(arena_memalign) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB ) SizeT saved_bytes_on_loan; Arena* a; - VGP_PUSHCC(VgpMalloc); - ensure_mm_init(aid); a = arenaId_to_ArenaP(aid); @@ -1301,8 +1290,6 @@ void* VG_(arena_memalign) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB ) sanity_check_malloc_arena(aid); # endif - VGP_POPCC(VgpMalloc); - vg_assert( (((Addr)align_p) % req_alignB) == 0 ); //zzVALGRIND_MALLOCLIKE_BLOCK(align_p, req_pszB, 0, False); @@ -1337,8 +1324,6 @@ void* VG_(arena_calloc) ( ArenaId aid, SizeT nmemb, SizeT bytes_per_memb ) SizeT size; UChar* p; - VGP_PUSHCC(VgpMalloc); - size = nmemb * bytes_per_memb; vg_assert(size >= nmemb && size >= bytes_per_memb);// check against overflow @@ -1348,8 +1333,6 @@ void* VG_(arena_calloc) ( ArenaId aid, SizeT nmemb, SizeT bytes_per_memb ) //zzVALGRIND_MALLOCLIKE_BLOCK(p, size, 0, True); - VGP_POPCC(VgpMalloc); - return p; } @@ -1361,8 +1344,6 @@ void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB ) UChar *p_new; Block* b; - VGP_PUSHCC(VgpMalloc); - ensure_mm_init(aid); a = arenaId_to_ArenaP(aid); @@ -1375,7 +1356,6 @@ void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB ) old_pszB = get_pszB(a, b); if (req_pszB <= old_pszB) { - VGP_POPCC(VgpMalloc); return ptr; } @@ -1385,7 +1365,6 @@ void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB ) VG_(arena_free)(aid, ptr); - VGP_POPCC(VgpMalloc); return p_new; } diff --git a/coregrind/m_options.c b/coregrind/m_options.c index e7555a5e..025e02e5 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -54,7 +54,6 @@ Bool VG_(clo_time_stamp) = False; Int VG_(clo_input_fd) = 0; /* stdin */ Int VG_(clo_n_suppressions) = 0; Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; -Bool VG_(clo_profile) = False; UChar VG_(clo_trace_flags) = 0; // 00000000b UChar VG_(clo_profile_flags) = 0; // 00000000b Int VG_(clo_trace_notbelow) = 0; diff --git a/coregrind/m_profile.c b/coregrind/m_profile.c deleted file mode 100644 index 212358f7..00000000 --- a/coregrind/m_profile.c +++ /dev/null @@ -1,171 +0,0 @@ - -/*--------------------------------------------------------------------*/ -/*--- Profiling machinery. m_profile.c ---*/ -/*--------------------------------------------------------------------*/ - -/* - This file is part of Valgrind, a dynamic binary instrumentation - framework. - - Copyright (C) 2000-2005 Julian Seward - jseward@acm.org - - 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 "pub_core_basics.h" -#include "pub_core_libcassert.h" -#include "pub_core_libcprint.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 += VgpUnc; - if (n >= 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] != 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 overlap.\n", - n, name, vgp_names[n]); - VG_(tool_panic)("profile event already registered"); - } - - vgp_names[n] = name; -} - -static void tick ( int sigNo ) -{ - Int cc; - vgp_nticks++; - cc = vgp_stack[vgp_sp]; - tl_assert(cc >= 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=yes. Aborting.\n"); - VG_(exit)(1); -#endif - - /* Register core events... tricky macro definition causes - 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) VG_(register_profile_event)(n,name) - VGP_CORE_LIST; -# undef VGP_PAIR - - vgp_sp = -1; - VG_(pushcc) ( VgpUnc ); - - value.it_interval.tv_sec = 0; - value.it_interval.tv_usec = 10 * 1000; - value.it_value = value.it_interval; - - signal(SIGPROF, tick ); - ret = setitimer(ITIMER_PROF, &value, NULL); - if (ret != 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 = 0; i < VGP_MAX_CCS; i++) - if (NULL != vgp_names[i]) - VG_(printf)( - "%2d: %4d (%3d %%%%) ticks, %10d entries for %s\n", - i, vgp_counts[i], - (Int)(1000.0 * (double)vgp_counts[i] / (double)vgp_nticks), - vgp_entries[i], vgp_names[i] ); -} - -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 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] = cc; - vgp_entries[ cc ] ++; -} - -void VG_(popcc) ( UInt cc ) -{ - if (vgp_sp <= 0) { - VG_(printf)( - "\nProfile stack underflow. This is due to a VG_(popcc)() without\n" - "a matching VG_(pushcc)(). Make sure they all match.\n"); - VG_(core_panic)("Profiling stack underflow"); - } - if (vgp_stack[vgp_sp] != cc) { - Int i; - VG_(printf)("profiling problem:\n"); - VG_(printf)("popping %s, stack looks like:\n", vgp_names[cc]); - for (i = vgp_sp; i >= 0; i--) - VG_(printf)("%2d: %s\n", i, vgp_names[vgp_stack[i]]); - VG_(exit)(1); - } - vgp_sp--; -} - -/*--------------------------------------------------------------------*/ -/*--- end ---*/ -/*--------------------------------------------------------------------*/ - - diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 113341cf..5e9539cb 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -73,7 +73,6 @@ #include "pub_core_machine.h" #include "pub_core_mallocfree.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" @@ -398,8 +397,6 @@ UInt run_thread_for_a_while ( ThreadId tid ) vg_assert(sz_spill == LibVEX_N_SPILL_BYTES); vg_assert(a_vex + 2 * sz_vex == a_spill); - VGP_PUSHCC(VgpRun); - # if defined(VGA_ppc32) /* This is necessary due to the hacky way vex models reservations on ppc. It's really quite incorrect for each thread to have its @@ -459,7 +456,6 @@ UInt run_thread_for_a_while ( ThreadId tid ) vg_assert(done_this_time >= 0); bbs_done += (ULong)done_this_time; - VGP_POPCC(VgpRun); return trc; } @@ -658,8 +654,6 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) if (VG_(clo_trace_sched)) print_sched_event(tid, "entering VG_(scheduler)"); - VGP_PUSHCC(VgpSched); - /* set the proper running signal mask */ block_signals(tid); @@ -863,8 +857,6 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) vg_assert(VG_(is_exiting)(tid)); - VGP_POPCC(VgpSched); - //if (VG_(clo_model_pthreads)) // VG_(tm_thread_exit)(tid); @@ -1156,8 +1148,6 @@ void VG_(sanity_check_general) ( Bool force_expensive ) { ThreadId tid; - VGP_PUSHCC(VgpCoreCheapSanity); - if (VG_(clo_sanity_level) < 1) return; /* --- First do all the tests that we can do quickly. ---*/ @@ -1169,9 +1159,7 @@ void VG_(sanity_check_general) ( Bool force_expensive ) /* Check that nobody has spuriously claimed that the first or last 16 pages of memory have become accessible [...] */ if (VG_(needs).sanity_checks) { - VGP_PUSHCC(VgpToolCheapSanity); vg_assert(VG_TDICT_CALL(tool_cheap_sanity_check)); - VGP_POPCC(VgpToolCheapSanity); } /* --- Now some more expensive checks. ---*/ @@ -1181,13 +1169,10 @@ void VG_(sanity_check_general) ( Bool force_expensive ) || VG_(clo_sanity_level) > 1 || (VG_(clo_sanity_level) == 1 && (sanity_fast_count % 25) == 0)) { - VGP_PUSHCC(VgpCoreExpensiveSanity); sanity_slow_count++; if (VG_(needs).sanity_checks) { - VGP_PUSHCC(VgpToolExpensiveSanity); vg_assert(VG_TDICT_CALL(tool_expensive_sanity_check)); - VGP_POPCC(VgpToolExpensiveSanity); } /* Look for stack overruns. Visit all threads. */ @@ -1210,20 +1195,15 @@ void VG_(sanity_check_general) ( Bool force_expensive ) "of running out of stack!", tid, remains); } - - VGP_POPCC(VgpCoreExpensiveSanity); } if (VG_(clo_sanity_level) > 1) { - VGP_PUSHCC(VgpCoreExpensiveSanity); /* Check sanity of the low-level memory manager. Note that bugs in the client's code can cause this to fail, so we don't do this check unless specially asked for. And because it's potentially very expensive. */ VG_(sanity_check_malloc_all)(); - VGP_POPCC(VgpCoreExpensiveSanity); } - VGP_POPCC(VgpCoreCheapSanity); } /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 63a3b93a..b835829a 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -37,7 +37,6 @@ #include "pub_core_libcprint.h" #include "pub_core_machine.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_stacktrace.h" #include "pub_core_trampoline.h" @@ -62,8 +61,6 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, Addr fp_max; UInt n_found = 0; - VGP_PUSHCC(VgpExeContext); - vg_assert(sizeof(Addr) == sizeof(UWord)); vg_assert(sizeof(Addr) == sizeof(void*)); @@ -93,7 +90,6 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, don't bomb out either. Needed to make John Regehr's user-space threads package work. JRS 20021001 */ ips[0] = ip; - VGP_POPCC(VgpExeContext); return 1; } @@ -292,7 +288,6 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips, # endif n_found = i; - VGP_POPCC(VgpExeContext); return n_found; } diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 219bb7e5..09ce93dc 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -38,7 +38,6 @@ #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" #include "pub_core_options.h" -#include "pub_core_profile.h" #include "pub_core_debuginfo.h" // Needed for pub_core_redir :( #include "pub_core_redir.h" // For VG_(code_redirect)() @@ -586,9 +585,6 @@ Bool VG_(translate) ( ThreadId tid, vex_init_done = True; } - /* profiling ... */ - VGP_PUSHCC(VgpTranslate); - /* Look in the code redirect table to see if we should translate an alternative address for orig_addr. */ redir = VG_(code_redirect)(orig_addr); @@ -681,8 +677,6 @@ Bool VG_(translate) ( ThreadId tid, verbosity = VG_(clo_trace_flags); } - VGP_PUSHCC(VgpVexTime); - /* ------ Actually do the translation. ------ */ tl_assert2(VG_(tdict).tool_instrument, "you forgot to set VgToolInterface function 'tool_instrument'"); @@ -732,8 +726,6 @@ Bool VG_(translate) ( ThreadId tid, vg_assert(tmpbuf_used <= N_TMPBUF); vg_assert(tmpbuf_used > 0); - VGP_POPCC(VgpVexTime); - /* Tell aspacem of all segments that have had translations taken from them. Optimisation: don't re-look up vge.base[0] since seg should already point to it. */ @@ -763,8 +755,6 @@ Bool VG_(translate) ( ThreadId tid, do_self_check ); } - VGP_POPCC(VgpTranslate); - return True; } diff --git a/coregrind/pub_core_profile.h b/coregrind/pub_core_profile.h deleted file mode 100644 index c87f8ab1..00000000 --- a/coregrind/pub_core_profile.h +++ /dev/null @@ -1,50 +0,0 @@ - -/*--------------------------------------------------------------------*/ -/*--- 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 - jseward@acm.org - - 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-based -// profiler. To use it, define VG_DO_PROFILING and use --profile=yes. -// 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 ---*/ -/*--------------------------------------------------------------------*/ diff --git a/docs/xml/writing-tools.xml b/docs/xml/writing-tools.xml index 0ef16484..a9893b1e 100644 --- a/docs/xml/writing-tools.xml +++ b/docs/xml/writing-tools.xml @@ -880,8 +880,8 @@ write regression tests for your tool:</para> <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 profile a tool, use Cachegrind on it. Read README_DEVELOPERS for +details on running Valgrind under Valgrind.</para> <para>To do simple tick-based profiling of a tool, include the line:</para> diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 9263714e..6ad4e1a6 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -51,7 +51,6 @@ #include "pub_tool_machine.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" @@ -1630,8 +1629,6 @@ void set_address_range_state ( Addr a, SizeT len /* in bytes */, "Warning: set address range state: large range %d", len); - //VGP_PUSHCC(VgpSARP); - /* Remove mutexes in recycled memory range from hash */ find_mutex_range(a, a+len, cleanmx); @@ -1677,8 +1674,6 @@ void set_address_range_state ( Addr a, SizeT len /* in bytes */, VG_(printf)("init_status = %u\n", status); VG_(tool_panic)("Unexpected Vge_InitStatus"); } - - //VGP_POPCC(VgpSARP); } diff --git a/include/Makefile.am b/include/Makefile.am index 5b9ed133..536bc112 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -21,7 +21,6 @@ incinc_HEADERS = \ pub_tool_mallocfree.h \ pub_tool_options.h \ pub_tool_oset.h \ - pub_tool_profile.h \ pub_tool_redir.h \ pub_tool_replacemalloc.h \ pub_tool_signals.h \ diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index edd94e03..ad5fa61e 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -66,9 +66,6 @@ /* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */ extern Int VG_(clo_verbosity); -/* Profile? default: NO */ -extern Bool VG_(clo_profile); - /* Emit all messages as XML? default: NO */ /* If clo_xml is set, various other options are set in a non-default way. See vg_main.c and mc_main.c. */ diff --git a/include/pub_tool_profile.h b/include/pub_tool_profile.h deleted file mode 100644 index a04b9891..00000000 --- a/include/pub_tool_profile.h +++ /dev/null @@ -1,91 +0,0 @@ - -/*--------------------------------------------------------------------*/ -/*--- 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 - jseward@acm.org - - 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. (But it's currently not working...) -//#define VG_DO_PROFILING 1 - -#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 one */ -#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 ---*/ -/*--------------------------------------------------------------------*/ diff --git a/massif/ms_main.c b/massif/ms_main.c index 3c3c99dc..dda257a4 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -46,7 +46,6 @@ #include "pub_tool_machine.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" @@ -199,25 +198,6 @@ typedef HP_Chunk; /*------------------------------------------------------------*/ -/*--- Profiling events ---*/ -/*------------------------------------------------------------*/ - -typedef - enum { - VgpGetXPt = VgpFini+1, - VgpGetXPtSearch, - VgpCensus, - VgpCensusHeap, - VgpCensusSnapshot, - VgpCensusTreeSize, - VgpUpdateXCon, - VgpCalcSpacetime2, - VgpPrintHp, - VgpPrintXPts, - } - VgpToolCC; - -/*------------------------------------------------------------*/ /*--- Statistics ---*/ /*------------------------------------------------------------*/ @@ -442,8 +422,6 @@ static XPt* get_XCon( ThreadId tid, Bool custom_malloc ) UInt overestimate; Bool reached_bottom; - VGP_PUSHCC(VgpGetXPt); - // Want at least clo_depth non-alloc-fn entries in the snapshot. // However, because we have 1 or more (an unknown number, at this point) // alloc-fns ignored, we overestimate the size needed for the stack @@ -490,7 +468,6 @@ static XPt* get_XCon( ThreadId tid, Bool custom_malloc ) // XXX: linear search, ugh -- about 10% of time for konqueror startup // XXX: tried cacheing last result, only hit about 4% for konqueror // Nb: this search hits about 98% of the time for konqueror - VGP_PUSHCC(VgpGetXPtSearch); // If we've searched/added deep enough, or run out of EIPs, this is // the bottom XPt. @@ -518,12 +495,10 @@ static XPt* get_XCon( ThreadId tid, Bool custom_malloc ) if (ips[L] == xpt->children[nC]->ip) break; // found the IP nC++; // keep looking } - VGP_POPCC(VgpGetXPtSearch); // Return found/built bottom-XPt. if (reached_bottom) { tl_assert(0 == xpt->children[nC]->n_children); // Must be bottom-XPt - VGP_POPCC(VgpGetXPt); return xpt->children[nC]; } @@ -536,8 +511,6 @@ static XPt* get_XCon( ThreadId tid, Bool custom_malloc ) // Update 'curr_space' of every XPt in the XCon, by percolating upwards. static void update_XCon(XPt* xpt, Int space_delta) { - VGP_PUSHCC(VgpUpdateXCon); - tl_assert(True == clo_heap); tl_assert(0 != space_delta); tl_assert(NULL != xpt); @@ -550,8 +523,6 @@ static void update_XCon(XPt* xpt, Int space_delta) } if (space_delta < 0) tl_assert(alloc_xpt->curr_space >= -space_delta); alloc_xpt->curr_space += space_delta; - - VGP_POPCC(VgpUpdateXCon); } // Actually want a reverse sort, biggest to smallest @@ -668,8 +639,6 @@ void* new_block ( ThreadId tid, void* p, SizeT size, SizeT align, Bool custom_alloc = (NULL == p); if (size < 0) return NULL; - VGP_PUSHCC(VgpCliMalloc); - // Update statistics n_allocs++; if (0 == size) n_zero_allocs++; @@ -678,7 +647,6 @@ void* new_block ( ThreadId tid, void* p, SizeT size, SizeT align, if (!p) { p = VG_(cli_malloc)( align, size ); if (!p) { - VGP_POPCC(VgpCliMalloc); return NULL; } if (is_zeroed) VG_(memset)(p, 0, size); @@ -700,7 +668,6 @@ void* new_block ( ThreadId tid, void* p, SizeT size, SizeT align, // do a census! hp_census(); - VGP_POPCC(VgpCliMalloc); return p; } @@ -709,8 +676,6 @@ void die_block ( void* p, Bool custom_free ) { HP_Chunk* hc; - VGP_PUSHCC(VgpCliMalloc); - // Update statistics n_frees++; @@ -732,8 +697,6 @@ void die_block ( void* p, Bool custom_free ) // do a census! hp_census(); - - VGP_POPCC(VgpCliMalloc); } @@ -784,12 +747,9 @@ static void* ms_realloc ( ThreadId tid, void* p_old, SizeT new_size ) SizeT old_size; XPt *old_where, *new_where; - VGP_PUSHCC(VgpCliMalloc); - // Remove the old block hc = VG_(HT_remove)(malloc_list, (UWord)p_old); if (hc == NULL) { - VGP_POPCC(VgpCliMalloc); return NULL; // must have been a bogus realloc() } @@ -831,7 +791,6 @@ static void* ms_realloc ( ThreadId tid, void* p_old, SizeT new_size ) // than growing it, and this way simplifies the growing case. VG_(HT_add_node)(malloc_list, hc); - VGP_POPCC(VgpCliMalloc); return p_new; } @@ -974,14 +933,11 @@ static void hp_census(void) Int ms_time, ms_time_since_prev; Census* census; - VGP_PUSHCC(VgpCensus); - // Only do a census if it's time ms_time = VG_(read_millisecond_timer)(); ms_time_since_prev = ms_time - ms_prev_census; if (ms_time < ms_next_census) { n_fake_censi++; - VGP_POPCC(VgpCensus); return; } n_real_censi++; @@ -1007,8 +963,6 @@ static void hp_census(void) VG_(ssort)(alloc_xpt->children, alloc_xpt->n_children, sizeof(XPt*), XPt_cmp_approx_ST); - VGP_PUSHCC(VgpCensusHeap); - // For each significant top-level XPt, record space info about its // entire XTree, in a single census entry. // Nb: the xtree_size count/snapshot buffer allocation, and the actual @@ -1018,9 +972,7 @@ static void hp_census(void) UInt xtree_size, xtree_size2; // VG_(printf)("%7u ", alloc_xpt->children[i]->approx_ST); // Count how many XPts are in the XTree - VGP_PUSHCC(VgpCensusTreeSize); xtree_size = get_xtree_size( alloc_xpt->children[i], 0 ); - VGP_POPCC(VgpCensusTreeSize); // If no XPts counted (ie. alloc_xpt.curr_space==0 or XTree // insignificant) then don't take any more snapshots. @@ -1039,18 +991,14 @@ static void hp_census(void) // (Except for ones with curr_space==0, which wouldn't contribute // to the final exact_ST_dbld calculation anyway; excluding them // saves a lot of memory and up to 40% time with big --depth valus. - VGP_PUSHCC(VgpCensusSnapshot); xtree_size2 = do_space_snapshot(alloc_xpt->children[i], census->xtree_snapshots[i], 0); tl_assert(xtree_size == xtree_size2); - VGP_POPCC(VgpCensusSnapshot); } // VG_(printf)("\n\n"); // Zero-terminate 'xtree_snapshot' array census->xtree_snapshots[i] = NULL; - VGP_POPCC(VgpCensusHeap); - //VG_(printf)("printed %d censi\n", K); // Lump the rest into a single "others" entry. @@ -1097,8 +1045,6 @@ static void hp_census(void) //ms_next_census += ms_interval; //VG_(printf)("Next: %d ms\n", ms_next_census); - - VGP_POPCC(VgpCensus); } /*------------------------------------------------------------*/ @@ -1227,8 +1173,6 @@ static void calc_exact_ST_dbld(ULong* heap2, ULong* heap_admin2, ULong* stack2) { UInt i, N = curr_census; - VGP_PUSHCC(VgpCalcSpacetime2); - *heap2 = 0; *heap_admin2 = 0; *stack2 = 0; @@ -1250,8 +1194,6 @@ static void calc_exact_ST_dbld(ULong* heap2, ULong* heap_admin2, ULong* stack2) *heap2 /= 2; *heap_admin2 /= 2; *stack2 /= 2; - - VGP_POPCC(VgpCalcSpacetime2); } /*------------------------------------------------------------*/ @@ -1333,8 +1275,6 @@ static void write_hp_file(void) Char* cmdbuf; Int cmdlen; - VGP_PUSHCC(VgpPrintHp); - // Open file hp_file = make_filename( base_dir, ".hp" ); ps_file = make_filename( base_dir, ".ps" ); @@ -1343,7 +1283,6 @@ static void write_hp_file(void) VKI_S_IRUSR|VKI_S_IWUSR); if (sres.isError) { file_err( hp_file ); - VGP_POPCC(VgpPrintHp); return; } else { fd = sres.val; @@ -1426,8 +1365,6 @@ static void write_hp_file(void) VG_(free)(hp_file); VG_(free)(ps_file); VG_(free)(aux_file); - - VGP_POPCC(VgpPrintHp); } /*------------------------------------------------------------*/ @@ -1651,8 +1588,6 @@ write_text_file(ULong total_ST, ULong heap_ST) Char* text_file; Char* maybe_p = ( XHTML == clo_format ? "<p>" : "" ); - VGP_PUSHCC(VgpPrintXPts); - // Open file text_file = make_filename( base_dir, ( XText == clo_format ? ".txt" : ".html" ) ); @@ -1661,7 +1596,6 @@ write_text_file(ULong total_ST, ULong heap_ST) VKI_S_IRUSR|VKI_S_IWUSR); if (sres.isError) { file_err( text_file ); - VGP_POPCC(VgpPrintXPts); return; } else { fd = sres.val; @@ -1693,8 +1627,6 @@ write_text_file(ULong total_ST, ULong heap_ST) tl_assert(fd >= 0); VG_(close)(fd); - - VGP_POPCC(VgpPrintXPts); } /*------------------------------------------------------------*/ @@ -1813,18 +1745,6 @@ static void ms_pre_clo_init(void) VG_(track_new_mem_stack_signal)( new_mem_stack_signal ); VG_(track_die_mem_stack_signal)( die_mem_stack_signal ); - // Profiling events - 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)( 80021 ); // prime, big diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index cd54e323..6ae9be5e 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -46,7 +46,6 @@ usage: valgrind [options] prog-and-args debugging options for all Valgrind tools: --sanity-level=<number> level of sanity checking to do [1] - --profile=no|yes profile? (tool must be built for it) [no] --trace-flags=<XXXXXXXX> show generated code? (X = 0|1) [00000000] --profile-flags=<XXXXXXXX> ditto, but for profiling (X = 0|1) [00000000] --trace-notbelow=<number> only show BBs above <number> [0] |