scheduler: begin rework

This commit is contained in:
Matheus
2025-08-19 00:44:14 -03:00
parent c10bebb9ef
commit 5098c09f26
7 changed files with 97 additions and 0 deletions
+4
View File
@@ -23,4 +23,8 @@ void sched_reschedule_on_cpu(struct cpu_t *cpu, bool target);
void sched_sleep_us(size_t us);
int sched_yield();
void sched_thread_running_callback(thread_t *thread);
void sched_thread_stopping_callback(thread_t *thread, bool sleeping);
void sched_thread_wakeup_callback(thread_t *thread);
#endif
+7
View File
@@ -52,6 +52,13 @@ typedef struct thread_t {
bool hasreturnmask;
bool stopped;
} signals;
struct {
int interactivity_score;
time_t sleep_time_avg_us;
time_t run_time_avg_us;
timespec_t sleep_start;
timespec_t run_start;
} metrics;
} thread_t;
__attribute__((noreturn)) void sched_threadexit();
+4
View File
@@ -24,6 +24,10 @@ static inline long min(long x, long y) {
return x > y ? y : x;
}
static inline long max(long x, long y) {
return x < y ? y : x;
}
#define FNV1PRIME 0x100000001b3ull
#define FNV1OFFSET 0xcbf29ce484222325ull