mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +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:
parent
4c4b8ea443
commit
0286160b62
6 changed files with 24 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <Kernel/Arch/x86/TrapFrame.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/PerformanceManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Sections.h>
|
||||
#include <Kernel/ThreadTracer.h>
|
||||
|
@ -108,6 +109,8 @@ KResultOr<FlatPtr> handle(RegisterState& regs, FlatPtr function, FlatPtr arg1, F
|
|||
auto& process = current_thread->process();
|
||||
current_thread->did_syscall();
|
||||
|
||||
PerformanceManager::add_syscall_event(*current_thread, regs);
|
||||
|
||||
if (function >= Function::__Count) {
|
||||
dbgln("Unknown syscall {} requested ({:p}, {:p}, {:p}, {:p})", function, arg1, arg2, arg3, arg4);
|
||||
return ENOSYS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue