]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move VG_(bbs_done) out of main and make it local in scheduler.c. This
authorNicholas Nethercote <njn@valgrind.org>
Sun, 19 Jun 2005 18:38:24 +0000 (18:38 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 19 Jun 2005 18:38:24 +0000 (18:38 +0000)
removes the dependence of m_translate.c and m_libcassert.c on m_main.c.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3954

coregrind/m_errormgr.c
coregrind/m_libcassert.c
coregrind/m_main.c
coregrind/m_scheduler/scheduler.c
coregrind/m_translate.c
coregrind/m_transtab.c
coregrind/pub_core_main.h
coregrind/pub_core_translate.h

index a192e35ffc923b9497c844791875f694192a460f..d8147efbde34654dbfae038186ce17dde56a46ae 100644 (file)
@@ -750,7 +750,8 @@ void VG_(show_all_errors) ( void )
       if ((i+1 == VG_(clo_dump_error))) {
          StackTrace ips = VG_(extract_StackTrace)(p_min->where);
          VG_(translate) ( 0 /* dummy ThreadId; irrelevant due to debugging*/,
-                          ips[0], /*debugging*/True, 0xFE/*verbosity*/);
+                          ips[0], /*debugging*/True, 0xFE/*verbosity*/,
+                          /*bbs_done*/0);
       }
 
       p_min->count = 1 << 30;
index ecaf6b6ac0441c843e0ba93a26ab8c5fb13ed429..61504ab291a31da7c9c9f6c95a79b4eebc4f749d 100644 (file)
@@ -34,8 +34,7 @@
 #include "pub_core_libcassert.h"
 #include "pub_core_libcprint.h"
 #include "pub_core_libcproc.h"
-#include "pub_core_main.h"          // for VG_(bbs_done) -- stupid!
-#include "pub_core_options.h"       // for VG_(bbs_done) -- stupid!
+#include "pub_core_options.h"
 #include "pub_core_stacktrace.h"
 #include "pub_core_syscall.h"
 #include "pub_core_tooliface.h"
@@ -110,7 +109,9 @@ static void report_and_quit ( const Char* report, Addr ip, Addr sp, Addr fp )
    VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop);
    VG_(pp_StackTrace)  (ips, BACKTRACE_DEPTH);
 
-   VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done) );
+   // Don't print this, as it's not terribly interesting and avoids a
+   // dependence on m_scheduler/, which would be crazy.
+   //VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done) );
 
    pp_sched_status();
    VG_(printf)("\n");
index 17525f831cc96ce0923d821b322098e267b4c74e..78b829f04a133ac4ae39075f4bd5e01b5b931dcb 100644 (file)
@@ -125,14 +125,6 @@ static Int  vg_argc;
 static Char **vg_argv;
 
 
-/* ---------------------------------------------------------------------
-   Running stuff                            
-   ------------------------------------------------------------------ */
-
-/* 64-bit counter for the number of basic blocks done. */
-ULong VG_(bbs_done) = 0;
-
-
 /*====================================================================*/
 /*=== Counters, for profiling purposes only                        ===*/
 /*====================================================================*/
@@ -145,8 +137,6 @@ static void print_all_stats ( void )
 {
    // Translation stats
    VG_(print_tt_tc_stats)();
-   VG_(message)(Vg_DebugMsg,
-      " dispatch: %llu jumps (bb entries).", VG_(bbs_done) );
 
    // Scheduler stats
    VG_(print_scheduler_stats)();
index 762e80e5119fd3455741b613e03273c1d93a6321..d6d2d42f3c42c1d996969a4c3032ea2a9ebe47d7 100644 (file)
@@ -104,6 +104,9 @@ Bool VG_(my_fault) = True;
 /* Counts downwards in VG_(run_innerloop). */
 UInt VG_(dispatch_ctr);
 
+/* 64-bit counter for the number of basic blocks done. */
+static ULong bbs_done = 0;
+
 /* Forwards */
 static void do_client_request ( ThreadId tid );
 static void scheduler_sanity ( ThreadId tid );
@@ -117,7 +120,9 @@ static UInt n_scheduling_events_MAJOR = 0;
 void VG_(print_scheduler_stats)(void)
 {
    VG_(message)(Vg_DebugMsg,
-      "           %d/%d major/minor sched events.", 
+      "scheduler: %llu jumps (bb entries).", bbs_done );
+   VG_(message)(Vg_DebugMsg,
+      "scheduler: %d/%d major/minor sched events.", 
       n_scheduling_events_MAJOR, n_scheduling_events_MINOR);
 }
 
@@ -419,7 +424,7 @@ UInt run_thread_for_a_while ( ThreadId tid )
    done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 0;
 
    vg_assert(done_this_time >= 0);
-   VG_(bbs_done) += (ULong)done_this_time;
+   bbs_done += (ULong)done_this_time;
 
    VGP_POPCC(VgpRun);
    return trc;
@@ -561,7 +566,7 @@ static void handle_tt_miss ( ThreadId tid )
    found = VG_(search_transtab)( NULL, ip, True/*upd_fast_cache*/ );
    if (!found) {
       /* Not found; we need to request a translation. */
-      if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/ )) {
+      if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/, bbs_done )) {
         found = VG_(search_transtab)( NULL, ip, True ); 
          vg_assert2(found, "VG_TRC_INNER_FASTMISS: missing tt_fast entry");
       
index d64914d19a1eba24fe769f620290a77fcc42a44a..7e229e879667319149b2ef49768797577a69c659 100644 (file)
@@ -36,7 +36,6 @@
 #include "pub_core_libcbase.h"
 #include "pub_core_libcassert.h"
 #include "pub_core_libcprint.h"
-#include "pub_core_main.h"       // for VG_(bbs_done)
 #include "pub_core_options.h"
 #include "pub_core_profile.h"
 #include "pub_core_redir.h"
@@ -417,7 +416,8 @@ static Bool chase_into_ok ( Addr64 addr64 )
 Bool VG_(translate) ( ThreadId tid, 
                       Addr64   orig_addr,
                       Bool     debugging_translation,
-                      Int      debugging_verbosity )
+                      Int      debugging_verbosity,
+                      ULong    bbs_done )
 {
    Addr64    redir, orig_addr0 = orig_addr;
    Int       tmpbuf_used, verbosity;
@@ -501,9 +501,9 @@ Bool VG_(translate) ( ThreadId tid,
       Char fnname[64] = "";
       VG_(get_fnname_w_offset)(orig_addr, fnname, 64);
       VG_(printf)(
-              "==== BB %d %s(0x%llx) approx BBs exec'd %lld ====\n",
+              "==== BB %d %s(0x%llx) BBs exec'd %lld ====\n",
               VG_(get_bbs_translated)(), fnname, orig_addr, 
-              VG_(bbs_done));
+              bbs_done);
    }
 
    if (seg == NULL ||
index e74cbcc24276e1a6d6b0051aa45ed9223a654827..a43453c22efefd54a46bad23f229a4eb7c98326a 100644 (file)
@@ -798,7 +798,7 @@ void VG_(show_BB_profile) ( void )
                   score_cumul, buf_cumul,
                   score_here,  buf_here, tops[r]->entry, name );
       VG_(printf)("\n");
-      VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags));
+      VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags), 0);
       VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-=  end BB rank %d  "
                   "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r);
    }
index 667d9db58717440956b04c2fc249d2c3fbfb29fd..541650d234340be01b85ca99754741d3a2e4e2da 100644 (file)
@@ -51,9 +51,6 @@ Char* VG_(build_child_exename)     ( void );
 /* Something of a function looking for a home ... start up debugger. */
 extern void VG_(start_debugger) ( ThreadId tid );
 
-/* 64-bit counter for the number of basic blocks done. */
-extern ULong VG_(bbs_done);
-
 // Set up the libc freeres wrapper 
 extern void VG_(set_libc_freeres_wrapper_addr)(Addr);
 
index d74f23c1041dc427b4b9448ab15c2909258d0760..5d2bb7a11d2a777e9320cd7adad5b863d78320e7 100644 (file)
@@ -40,7 +40,8 @@ extern
 Bool VG_(translate) ( ThreadId tid, 
                       Addr64   orig_addr,
                       Bool     debugging_translation,
-                      Int      debugging_verbosity );
+                      Int      debugging_verbosity,
+                      ULong    bbs_done );
 
 #endif   // __PUB_CORE_TRANSLATE_H