From: Julian Seward Date: Tue, 7 Jun 2011 22:54:32 +0000 (+0000) Subject: Add a simple but (to me, at least) useful thing, if (0)'d by default, X-Git-Tag: svn/VALGRIND_3_7_0~434 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=532b65e3377054c3e3d49010f8379afae3804903;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11803 --- diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index a5d1cfb14c..9b9e3dc10f 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -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))