From: Philippe Waroquiers Date: Wed, 23 Jan 2013 22:19:36 +0000 (+0000) Subject: Avoid doing a useless system call in scheduler sanity check X-Git-Tag: svn/VALGRIND_3_9_0~418 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbc1a5d2d6234261c4fcdbfb0357fe4b400f5e92;p=thirdparty%2Fvalgrind.git Avoid doing a useless system call in scheduler sanity check git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13263 --- diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index d6905e49c1..ebe6eb40e4 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1973,8 +1973,6 @@ static void scheduler_sanity ( ThreadId tid ) { Bool bad = False; - static UInt lasttime = 0; - UInt now; Int lwpid = VG_(gettid)(); if (!VG_(is_running_thread)(tid)) { @@ -1999,14 +1997,18 @@ void scheduler_sanity ( ThreadId tid ) bad = True; } - /* Periodically show the state of all threads, for debugging - purposes. */ - now = VG_(read_millisecond_timer)(); - if (0 && (!bad) && (lasttime + 4000/*ms*/ <= now)) { - lasttime = now; - VG_(printf)("\n------------ Sched State at %d ms ------------\n", - (Int)now); - VG_(show_sched_status)(); + if (0) { + /* Periodically show the state of all threads, for debugging + purposes. */ + static UInt lasttime = 0; + UInt now; + now = VG_(read_millisecond_timer)(); + if ((!bad) && (lasttime + 4000/*ms*/ <= now)) { + lasttime = now; + VG_(printf)("\n------------ Sched State at %d ms ------------\n", + (Int)now); + VG_(show_sched_status)(); + } } /* core_panic also shows the sched status, which is why we don't