diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-05-18 02:26:11 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-19 22:51:42 +0200 |
commit | 83fc591cea615c7c6efda62d92a08cb0dd932af0 (patch) | |
tree | 0b1de2dfe52104f4829252e048c1404f84a7ff75 /Userland/Utilities | |
parent | 6ac1ca5a9afbc900a483a1c528eb4b1c62a1c67e (diff) | |
download | serenity-83fc591cea615c7c6efda62d92a08cb0dd932af0.zip |
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>
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/profile.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Utilities/profile.cpp b/Userland/Utilities/profile.cpp index 5b16c08daa..6bce266bac 100644 --- a/Userland/Utilities/profile.cpp +++ b/Userland/Utilities/profile.cpp @@ -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)) { |