From: Julian Seward Date: Tue, 7 May 2002 09:25:30 +0000 (+0000) Subject: Minor profiling improvements. Add a couple of cost centers. X-Git-Tag: svn/VALGRIND_1_0_3~239 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37f7143de60af545c7c28587821b6966652528a1;p=thirdparty%2Fvalgrind.git Minor profiling improvements. Add a couple of cost centers. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@223 --- diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index 4b36e443da..61d5517aa5 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -293,9 +293,11 @@ extern void VG_(shutdown_logging) ( void ); #define VGP_M_STACK 10 -#define VGP_M_CCS 24 /* == the # of elems in VGP_LIST */ +#define VGP_M_CCS 26 /* == the # of elems in VGP_LIST */ #define VGP_LIST \ - VGP_PAIR(VgpRun=0, "running"), \ + VGP_PAIR(VgpUnc=0, "unclassified"), \ + 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"), \ diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 1b6bba33be..8397698bca 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -1050,8 +1050,10 @@ void VG_(main) ( void ) VG_(bbs_to_go) = VG_(clo_stop_after); + VGP_PUSHCC(VgpSched); VG_(scheduler_init)(); src = VG_(scheduler)(); + VGP_POPCC; if (VG_(clo_verbosity) > 0) VG_(message)(Vg_UserMsg, ""); diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index ea24997adb..6e9a96bf9e 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -465,6 +465,7 @@ UInt run_thread_for_a_while ( ThreadId tid ) vg_assert(vg_threads[tid].status == VgTs_Runnable); vg_assert(VG_(bbs_to_go) > 0); + VGP_PUSHCC(VgpRun); VG_(load_thread_state) ( tid ); if (__builtin_setjmp(VG_(scheduler_jmpbuf)) == 0) { /* try this ... */ @@ -477,6 +478,7 @@ UInt run_thread_for_a_while ( ThreadId tid ) trc = VG_TRC_UNRESUMABLE_SIGNAL; } VG_(save_thread_state) ( tid ); + VGP_POPCC; return trc; } diff --git a/coregrind/vg_translate.c b/coregrind/vg_translate.c index 39f444ff7b..1e4bff28d8 100644 --- a/coregrind/vg_translate.c +++ b/coregrind/vg_translate.c @@ -3085,32 +3085,32 @@ void VG_(translate) ( ThreadState* tst, cb = VG_(allocCodeBlock)(); /* Disassemble this basic block into cb. */ - VGP_PUSHCC(VgpToUCode); + /* VGP_PUSHCC(VgpToUCode); */ n_disassembled_bytes = VG_(disBB) ( cb, orig_addr ); - VGP_POPCC; + /* VGP_POPCC; */ /* dis=True; */ /* if (0&& VG_(translations_done) < 617) */ /* dis=False; */ /* Try and improve the code a bit. */ if (VG_(clo_optimise)) { - VGP_PUSHCC(VgpImprove); + /* VGP_PUSHCC(VgpImprove); */ vg_improve ( cb ); if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Improved code:" ); - VGP_POPCC; + /* VGP_POPCC; */ } /* dis=False; */ /* Add instrumentation code. */ if (VG_(clo_instrument)) { - VGP_PUSHCC(VgpInstrument); + /* VGP_PUSHCC(VgpInstrument); */ cb = vg_instrument(cb); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Instrumented code:" ); if (VG_(clo_cleanup)) { - VGP_PUSHCC(VgpCleanup); + /* VGP_PUSHCC(VgpCleanup); */ vg_cleanup(cb); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Cleaned-up instrumented code:" ); } @@ -3120,9 +3120,9 @@ void VG_(translate) ( ThreadState* tst, /* Add cache simulation code. */ if (VG_(clo_cachesim)) { - VGP_PUSHCC(VgpCacheInstrument); + /* VGP_PUSHCC(VgpCacheInstrument); */ cb = VG_(cachesim_instrument)(cb, orig_addr); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Cachesim instrumented code:" ); } @@ -3130,20 +3130,20 @@ void VG_(translate) ( ThreadState* tst, //VG_(disassemble) = False; /* Allocate registers. */ - VGP_PUSHCC(VgpRegAlloc); + /* VGP_PUSHCC(VgpRegAlloc); */ cb = vg_do_register_allocation ( cb ); - VGP_POPCC; + /* VGP_POPCC; */ /* dis=False; */ /* if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "After Register Allocation:"); */ - VGP_PUSHCC(VgpFromUcode); + /* VGP_PUSHCC(VgpFromUcode); */ /* NB final_code is allocated with VG_(jitmalloc), not VG_(malloc) and so must be VG_(jitfree)'d. */ final_code = VG_(emit_code)(cb, &final_code_size ); - VGP_POPCC; + /* VGP_POPCC; */ VG_(freeCodeBlock)(cb); if (debugging_translation) { diff --git a/include/vg_profile.c b/include/vg_profile.c index 030f4068c1..34e98d6e70 100644 --- a/include/vg_profile.c +++ b/include/vg_profile.c @@ -67,7 +67,7 @@ void VGP_(init_profiling) ( void ) vgp_nticks = 0; vgp_sp = -1; - VGP_(pushcc) ( VgpRun ); + VGP_(pushcc) ( VgpUnc ); value.it_interval.tv_sec = 0; value.it_interval.tv_usec = 10 * 1000; diff --git a/vg_include.h b/vg_include.h index 4b36e443da..61d5517aa5 100644 --- a/vg_include.h +++ b/vg_include.h @@ -293,9 +293,11 @@ extern void VG_(shutdown_logging) ( void ); #define VGP_M_STACK 10 -#define VGP_M_CCS 24 /* == the # of elems in VGP_LIST */ +#define VGP_M_CCS 26 /* == the # of elems in VGP_LIST */ #define VGP_LIST \ - VGP_PAIR(VgpRun=0, "running"), \ + VGP_PAIR(VgpUnc=0, "unclassified"), \ + 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"), \ diff --git a/vg_main.c b/vg_main.c index 1b6bba33be..8397698bca 100644 --- a/vg_main.c +++ b/vg_main.c @@ -1050,8 +1050,10 @@ void VG_(main) ( void ) VG_(bbs_to_go) = VG_(clo_stop_after); + VGP_PUSHCC(VgpSched); VG_(scheduler_init)(); src = VG_(scheduler)(); + VGP_POPCC; if (VG_(clo_verbosity) > 0) VG_(message)(Vg_UserMsg, ""); diff --git a/vg_profile.c b/vg_profile.c index 030f4068c1..34e98d6e70 100644 --- a/vg_profile.c +++ b/vg_profile.c @@ -67,7 +67,7 @@ void VGP_(init_profiling) ( void ) vgp_nticks = 0; vgp_sp = -1; - VGP_(pushcc) ( VgpRun ); + VGP_(pushcc) ( VgpUnc ); value.it_interval.tv_sec = 0; value.it_interval.tv_usec = 10 * 1000; diff --git a/vg_scheduler.c b/vg_scheduler.c index ea24997adb..6e9a96bf9e 100644 --- a/vg_scheduler.c +++ b/vg_scheduler.c @@ -465,6 +465,7 @@ UInt run_thread_for_a_while ( ThreadId tid ) vg_assert(vg_threads[tid].status == VgTs_Runnable); vg_assert(VG_(bbs_to_go) > 0); + VGP_PUSHCC(VgpRun); VG_(load_thread_state) ( tid ); if (__builtin_setjmp(VG_(scheduler_jmpbuf)) == 0) { /* try this ... */ @@ -477,6 +478,7 @@ UInt run_thread_for_a_while ( ThreadId tid ) trc = VG_TRC_UNRESUMABLE_SIGNAL; } VG_(save_thread_state) ( tid ); + VGP_POPCC; return trc; } diff --git a/vg_translate.c b/vg_translate.c index 39f444ff7b..1e4bff28d8 100644 --- a/vg_translate.c +++ b/vg_translate.c @@ -3085,32 +3085,32 @@ void VG_(translate) ( ThreadState* tst, cb = VG_(allocCodeBlock)(); /* Disassemble this basic block into cb. */ - VGP_PUSHCC(VgpToUCode); + /* VGP_PUSHCC(VgpToUCode); */ n_disassembled_bytes = VG_(disBB) ( cb, orig_addr ); - VGP_POPCC; + /* VGP_POPCC; */ /* dis=True; */ /* if (0&& VG_(translations_done) < 617) */ /* dis=False; */ /* Try and improve the code a bit. */ if (VG_(clo_optimise)) { - VGP_PUSHCC(VgpImprove); + /* VGP_PUSHCC(VgpImprove); */ vg_improve ( cb ); if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Improved code:" ); - VGP_POPCC; + /* VGP_POPCC; */ } /* dis=False; */ /* Add instrumentation code. */ if (VG_(clo_instrument)) { - VGP_PUSHCC(VgpInstrument); + /* VGP_PUSHCC(VgpInstrument); */ cb = vg_instrument(cb); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Instrumented code:" ); if (VG_(clo_cleanup)) { - VGP_PUSHCC(VgpCleanup); + /* VGP_PUSHCC(VgpCleanup); */ vg_cleanup(cb); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Cleaned-up instrumented code:" ); } @@ -3120,9 +3120,9 @@ void VG_(translate) ( ThreadState* tst, /* Add cache simulation code. */ if (VG_(clo_cachesim)) { - VGP_PUSHCC(VgpCacheInstrument); + /* VGP_PUSHCC(VgpCacheInstrument); */ cb = VG_(cachesim_instrument)(cb, orig_addr); - VGP_POPCC; + /* VGP_POPCC; */ if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "Cachesim instrumented code:" ); } @@ -3130,20 +3130,20 @@ void VG_(translate) ( ThreadState* tst, //VG_(disassemble) = False; /* Allocate registers. */ - VGP_PUSHCC(VgpRegAlloc); + /* VGP_PUSHCC(VgpRegAlloc); */ cb = vg_do_register_allocation ( cb ); - VGP_POPCC; + /* VGP_POPCC; */ /* dis=False; */ /* if (VG_(disassemble)) VG_(ppUCodeBlock) ( cb, "After Register Allocation:"); */ - VGP_PUSHCC(VgpFromUcode); + /* VGP_PUSHCC(VgpFromUcode); */ /* NB final_code is allocated with VG_(jitmalloc), not VG_(malloc) and so must be VG_(jitfree)'d. */ final_code = VG_(emit_code)(cb, &final_code_size ); - VGP_POPCC; + /* VGP_POPCC; */ VG_(freeCodeBlock)(cb); if (debugging_translation) {