mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
Kernel: Generate page fault events from the kernel profiler
Hook the kernel page fault handler and capture page fault events when the fault has a current thread attached in TLS. We capture the eip and ebp so we can unwind the stack and locate which pieces of code are generating the most page faults. Co-authored-by: Gunnar Beutner <gbeutner@serenityos.org>
This commit is contained in:
parent
6ac1ca5a9a
commit
83fc591cea
7 changed files with 47 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <Kernel/Interrupts/UnhandledInterruptHandler.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/PerformanceManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
@ -243,8 +244,11 @@ void page_fault_handler(TrapFrame* trap)
|
|||
|
||||
auto current_thread = Thread::current();
|
||||
|
||||
if (current_thread)
|
||||
if (current_thread) {
|
||||
current_thread->set_handling_page_fault(true);
|
||||
PerformanceManager::add_page_fault_event(*current_thread, regs);
|
||||
}
|
||||
|
||||
ScopeGuard guard = [current_thread] {
|
||||
if (current_thread)
|
||||
current_thread->set_handling_page_fault(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue