]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a simple but (to me, at least) useful thing, if (0)'d by default,
authorJulian Seward <jseward@acm.org>
Tue, 7 Jun 2011 22:54:32 +0000 (22:54 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 7 Jun 2011 22:54:32 +0000 (22:54 +0000)
to print a line of text approximately every 20 million SBs.  This is
useful for monitoring the progress of long running programs.

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

coregrind/m_scheduler/scheduler.c

index a5d1cfb14c5f7025a4376e6987c25528dbb596ca..9b9e3dc10f9a15f775df4a66b593b8d36049b12a 100644 (file)
@@ -160,6 +160,21 @@ void print_sched_event ( ThreadId tid, Char* what )
    VG_(message)(Vg_DebugMsg, "  SCHED[%d]: %s\n", tid, what );
 }
 
+/* For showing SB counts, if the user asks to see them. */
+#define SHOW_SBCOUNT_EVERY (20ULL * 1000 * 1000)
+static ULong bbs_done_lastcheck = 0;
+
+static
+void maybe_show_sb_counts ( void )
+{
+   Long delta = bbs_done - bbs_done_lastcheck;
+   vg_assert(delta >= 0);
+   if (UNLIKELY(delta >= SHOW_SBCOUNT_EVERY)) {
+      VG_(umsg)("%'lld superblocks executed\n", bbs_done);
+      bbs_done_lastcheck = bbs_done;
+   }
+}
+
 static
 HChar* name_of_sched_event ( UInt event )
 {
@@ -1347,6 +1362,9 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid )
         break;
 
       } /* switch (trc) */
+
+      if (0)
+         maybe_show_sb_counts();
    }
 
    if (VG_(clo_trace_sched))