implement thread_get_nice & thread_get_recent_cpu

This commit is contained in:
2024-10-15 19:56:46 +01:00
parent 82cc108c38
commit 630fbaa3ab
2 changed files with 4 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
#include <random.h>
#include <stdio.h>
#include <string.h>
#include "threads/fixed-point.h"
#include "threads/flags.h"
#include "threads/interrupt.h"
#include "threads/intr-stubs.h"
@@ -399,8 +400,7 @@ thread_get_load_avg (void)
int
thread_get_recent_cpu (void)
{
/* Not yet implemented. */
return 0;
return fp_round (fp_mul_int (thread_current ()->recent_cpu, 100));
}
/* Idle thread. Executes when no other thread is ready to run.