1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

Everywhere: Make tracking cpu usage independent from system ticks

This switches tracking CPU usage to more accurately measure time in
user and kernel land using either the TSC or another time source.
This will also come in handy when implementing a tickless kernel mode.
This commit is contained in:
Tom 2021-07-14 21:46:32 -06:00 committed by Andreas Kling
parent 7e77a2ec40
commit a635ff4e60
13 changed files with 174 additions and 85 deletions

View file

@ -24,7 +24,7 @@ extern WaitQueue* g_finalizer_wait_queue;
extern Atomic<bool> g_finalizer_has_work;
extern RecursiveSpinLock g_scheduler_lock;
struct TotalTicksScheduled {
struct TotalTimeScheduled {
u64 total { 0 };
u64 total_kernel { 0 };
};
@ -54,7 +54,9 @@ public:
static void queue_runnable_thread(Thread&);
static void dump_scheduler_state(bool = false);
static bool is_initialized();
static TotalTicksScheduled get_total_ticks_scheduled();
static TotalTimeScheduled get_total_time_scheduled();
static void add_time_scheduled(u64, bool);
static u64 (*current_time)();
};
}