Fix order of checks on load average.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Jan 2007 04:21:55 +0000 (04:21 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Jan 2007 04:21:55 +0000 (04:21 +0000)
From a CS140 student, via Ben Sapp.

src/tests/threads/mlfqs-load-1.c

index 6b230aa730c15be5ba708a990639a3910f1a6ffe..a39eea27ff32ff60540b5017959a95274b80c03a 100644 (file)
@@ -31,12 +31,12 @@ test_mlfqs_load_1 (void)
       load_avg = thread_get_load_avg ();
       ASSERT (load_avg >= 0);
       elapsed = timer_elapsed (start_time) / TIMER_FREQ;
-      if (load_avg > 50)
-        break;
-      else if (load_avg > 100)
+      if (load_avg > 100)
         fail ("load average is %d.%02d "
               "but should be between 0 and 1 (after %d seconds)",
               load_avg / 100, load_avg % 100, elapsed);
+      else if (load_avg > 50)
+        break;
       else if (elapsed > 45)
         fail ("load average stayed below 0.5 for more than 45 seconds");
     }