mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
Kernel: Start working on a syscall for logging performance events
This patch introduces sys$perf_event() with two event types: - PERF_EVENT_MALLOC - PERF_EVENT_FREE After the first call to sys$perf_event(), a process will begin keeping these events in a buffer. When the process dies, that buffer will be written out to "perfcore" in the current directory unless that filename is already taken. This is probably not the best way to do this, but it's a start and will make it possible to start doing memory allocation profiling. :^)
This commit is contained in:
parent
25b635c841
commit
3879e5b9d4
7 changed files with 225 additions and 1 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <AK/Weakable.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/PerformanceEventBuffer.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <Kernel/TTY/TTY.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
@ -301,6 +302,7 @@ public:
|
|||
int sys$chroot(const char* path, size_t path_length, int mount_flags);
|
||||
int sys$pledge(const Syscall::SC_pledge_params*);
|
||||
int sys$unveil(const Syscall::SC_unveil_params*);
|
||||
int sys$perf_event(int type, uintptr_t arg1, uintptr_t arg2);
|
||||
|
||||
template<bool sockname, typename Params>
|
||||
int get_sock_or_peer_name(const Params&);
|
||||
|
@ -511,6 +513,8 @@ private:
|
|||
|
||||
WaitQueue& futex_queue(i32*);
|
||||
HashMap<u32, OwnPtr<WaitQueue>> m_futex_queues;
|
||||
|
||||
OwnPtr<PerformanceEventBuffer> m_perf_event_buffer;
|
||||
};
|
||||
|
||||
class ProcessInspectionHandle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue