]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor profiling improvements. Add a couple of cost centers.
authorJulian Seward <jseward@acm.org>
Tue, 7 May 2002 09:25:30 +0000 (09:25 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 7 May 2002 09:25:30 +0000 (09:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@223

coregrind/vg_include.h
coregrind/vg_main.c
coregrind/vg_scheduler.c
coregrind/vg_translate.c
include/vg_profile.c
vg_include.h
vg_main.c
vg_profile.c
vg_scheduler.c
vg_translate.c

index 4b36e443dabf971a36b410f157381b35c9822491..61d5517aa53ba11c62cba598078c3f219d5f9cae 100644 (file)
@@ -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"),         \
index 1b6bba33be98896ad0369ba6aba1c6a7845d83d1..8397698bca7d976bbc4c11982bacf90e0204542e 100644 (file)
@@ -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, "");
index ea24997adb56c35b0a2b9bf7755b98eb976aa83c..6e9a96bf9eefd76d34f3517a6b92cdfc38f6ec01 100644 (file)
@@ -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;
 }
 
index 39f444ff7bb952f8d634c8e4f9818f2168f18f0f..1e4bff28d8447e0f920858f548bc9be902c345d6 100644 (file)
@@ -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) {
index 030f4068c163ecc754416ce135fd18780bd2871f..34e98d6e7048b52f62dab7e2e7d11a2d929bd800 100644 (file)
@@ -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;
index 4b36e443dabf971a36b410f157381b35c9822491..61d5517aa53ba11c62cba598078c3f219d5f9cae 100644 (file)
@@ -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"),         \
index 1b6bba33be98896ad0369ba6aba1c6a7845d83d1..8397698bca7d976bbc4c11982bacf90e0204542e 100644 (file)
--- 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, "");
index 030f4068c163ecc754416ce135fd18780bd2871f..34e98d6e7048b52f62dab7e2e7d11a2d929bd800 100644 (file)
@@ -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;
index ea24997adb56c35b0a2b9bf7755b98eb976aa83c..6e9a96bf9eefd76d34f3517a6b92cdfc38f6ec01 100644 (file)
@@ -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;
 }
 
index 39f444ff7bb952f8d634c8e4f9818f2168f18f0f..1e4bff28d8447e0f920858f548bc9be902c345d6 100644 (file)
@@ -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) {