Kernel: Track performance events for context switches

This commit is contained in:
Gunnar Beutner 2021-05-14 07:48:53 +02:00 committed by Andreas Kling
commit 8b2ace0326
Notes: sideshowbarker 2024-07-18 17:45:47 +09:00
6 changed files with 29 additions and 2 deletions

View file

@ -10,6 +10,7 @@
#include <AK/Time.h>
#include <Kernel/Debug.h>
#include <Kernel/Panic.h>
#include <Kernel/PerformanceManager.h>
#include <Kernel/Process.h>
#include <Kernel/RTC.h>
#include <Kernel/Scheduler.h>
@ -365,6 +366,8 @@ bool Scheduler::context_switch(Thread* thread)
}
thread->set_state(Thread::Running);
PerformanceManager::add_context_switch_perf_event(*from_thread, *thread);
proc.switch_context(from_thread, thread);
// NOTE: from_thread at this point reflects the thread we were