|
From: <sv...@va...> - 2011-06-07 22:59:23
|
Author: sewardj
Date: 2011-06-07 23:54:32 +0100 (Tue, 07 Jun 2011)
New Revision: 11803
Log:
Add a simple but (to me, at least) useful thing, if (0)'d by default,
to print a line of text approximately every 20 million SBs. This is
useful for monitoring the progress of long running programs.
Modified:
trunk/coregrind/m_scheduler/scheduler.c
Modified: trunk/coregrind/m_scheduler/scheduler.c
===================================================================
--- trunk/coregrind/m_scheduler/scheduler.c 2011-06-07 22:53:21 UTC (rev 11802)
+++ trunk/coregrind/m_scheduler/scheduler.c 2011-06-07 22:54:32 UTC (rev 11803)
@@ -160,7 +160,22 @@
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 )
{
switch (event) {
@@ -1347,6 +1362,9 @@
break;
} /* switch (trc) */
+
+ if (0)
+ maybe_show_sb_counts();
}
if (VG_(clo_trace_sched))
|