mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +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
|
@ -44,6 +44,8 @@ int main(int argc, char** argv)
|
|||
event_mask |= PERF_EVENT_KMALLOC;
|
||||
else if (event_type == "kfree")
|
||||
event_mask |= PERF_EVENT_KFREE;
|
||||
else if (event_type == "page_fault")
|
||||
event_mask |= PERF_EVENT_PAGE_FAULT;
|
||||
else {
|
||||
warnln("Unknown event type '{}' specified.", event_type);
|
||||
exit(1);
|
||||
|
@ -53,7 +55,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto print_types = [] {
|
||||
outln();
|
||||
outln("Event type can be one of: sample, context_switch, kmalloc and kfree.");
|
||||
outln("Event type can be one of: sample, context_switch, page_fault, kmalloc and kfree.");
|
||||
};
|
||||
|
||||
if (!args_parser.parse(argc, argv, false)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue