26 msg (
"spinning for up to 45 seconds, please wait...");
35 fail (
"load average is %d.%02d "
36 "but should be between 0 and 1 (after %d seconds)",
37 load_avg / 100, load_avg % 100, elapsed);
38 else if (load_avg > 50)
40 else if (elapsed > 45)
41 fail (
"load average stayed below 0.5 for more than 45 seconds");
45 fail (
"load average took only %d seconds to rise above 0.5", elapsed);
46 msg (
"load average rose to 0.5 after %d seconds", elapsed);
48 msg (
"sleeping for another 10 seconds, please wait...");
53 fail (
"load average fell below 0");
55 fail (
"load average stayed above 0.5 for more than 10 seconds");
56 msg (
"load average fell back below 0.5 (to %d.%02d)",
57 load_avg / 100, load_avg % 100);
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
void fail(const char *format,...)
void msg(const char *format,...)
void test_mlfqs_load_1(void)
Verifies that a single busy thread raises the load average to 0.5 in 38 to 45 seconds.
static int64_t start_time
Starts 60 threads that each sleep for 10 seconds, then spin in a tight loop for 60 seconds,...
signed long long int int64_t
void pass(void)
Prints a message indicating the current test passed.
bool thread_mlfqs
If false (default), use round-robin scheduler.
int thread_get_load_avg(void)
Returns 100 times the system load average.
int64_t timer_ticks(void)
Returns the number of timer ticks since the OS booted.
int64_t timer_elapsed(int64_t then)
Returns the number of timer ticks elapsed since THEN, which should be a value once returned by timer_...
void timer_sleep(int64_t ticks)
Sleeps for approximately TICKS timer ticks.
#define TIMER_FREQ
Number of timer interrupts per second.