]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Avoid doing a useless system call in scheduler sanity check
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 23 Jan 2013 22:19:36 +0000 (22:19 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 23 Jan 2013 22:19:36 +0000 (22:19 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13263

coregrind/m_scheduler/scheduler.c

index d6905e49c18000b9c7768063eb5f1887ff631b82..ebe6eb40e4b0851b22a51bb7b67a807218023c06 100644 (file)
@@ -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