1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:57:35 +00:00

Kernel: Add syscall performance event type

This allows tracing the syscalls made by a thread through the kernel's
performance event framework, which is similar in principle to strace.

Currently, this merely logs a stack backtrace to the current thread's
performance event buffer whenever a syscall is made, if profiling is
enabled. Future improvements could include tracing the arguments and
the return value, for example.
This commit is contained in:
Jean-Baptiste Boric 2021-08-10 21:02:59 +02:00 committed by Andreas Kling
parent 4c4b8ea443
commit 0286160b62
6 changed files with 24 additions and 1 deletions

View file

@ -45,6 +45,8 @@ int main(int argc, char** argv)
event_mask |= PERF_EVENT_KFREE;
else if (event_type == "page_fault")
event_mask |= PERF_EVENT_PAGE_FAULT;
else if (event_type == "syscall")
event_mask |= PERF_EVENT_SYSCALL;
else {
warnln("Unknown event type '{}' specified.", event_type);
exit(1);
@ -54,7 +56,7 @@ int main(int argc, char** argv)
auto print_types = [] {
outln();
outln("Event type can be one of: sample, context_switch, page_fault, kmalloc and kfree.");
outln("Event type can be one of: sample, context_switch, page_fault, syscall, kmalloc and kfree.");
};
if (!args_parser.parse(argc, argv, Core::ArgsParser::FailureBehavior::PrintUsage)) {