From a CS140 student, via Ben Sapp.
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");
}