summaryrefslogtreecommitdiff
path: root/Kernel/PerformanceEventBuffer.h
AgeCommit message (Collapse)Author
2021-03-02Kernel+Profiler: Capture metadata about all profiled processesAndreas Kling
The perfcore file format was previously limited to a single process since the pid/executable/regions data was top-level in the JSON. This patch moves the process-specific data into a top-level array named "processes" and we now add entries for each process that has been sampled during the profile run. This makes it possible to see samples from multiple threads when viewing a perfcore file with Profiler. This is extremely cool! :^)
2021-03-02Kernel: Start work on full system profiling :^)Andreas Kling
The superuser can now call sys$profiling_enable() with PID -1 to enable profiling of all running threads in the system. The perf events are collected in a global PerformanceEventBuffer (currently 32 MiB in size.) The events can be accessed via /proc/profile
2021-03-02Kernel: Better handling of allocation failure in profilingAndreas Kling
If we can't allocate a PerformanceEventBuffer to store the profiling events, we now fail sys$profiling_enable() and sys$perf_event() with ENOMEM instead of carrying on with a broken buffer.
2021-01-17Kernel: Prune uninteresting kernel frames from profiling samplesAndreas Kling
Start capturing the sample stacks at the EIP/EBP of the pre-empted thread instead of capturing EBP in the sampling function itself.
2021-01-11Kernel+Profiler: Make profiling per-process and without core dumpsAndreas Kling
This patch merges the profiling functionality in the kernel with the performance events mechanism. A profiler sample is now just another perf event, rather than a dedicated thing. Since perf events were already per-process, this now makes profiling per-process as well. Processes with perf events would already write out a perfcore.PID file to the current directory on death, but since we may want to profile a process and then let it continue running, recorded perf events can now be accessed at any time via /proc/PID/perf_events. This patch also adds information about process memory regions to the perfcore JSON format. This removes the need to supply a core dump to the Profiler app for symbolication, and so the "profiler coredump" mechanism is removed entirely. There's still a hard limit of 4MB worth of perf events per process, so this is by no means a perfect final design, but it's a nice step forward for both simplicity and stability. Fixes #4848 Fixes #4849
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-12-19Kernel: Use fallible KBuffer API in PerformanceEventBufferAndreas Kling
2020-12-18Kernel: Move KBufferBuilder to the fallible KBuffer APIAndreas Kling
KBufferBuilder::build() now returns an OwnPtr<KBuffer> and can fail. Clients of the API have been updated to handle that situation.
2020-08-10Kernel: PID/TID typingBen Wiederhake
This compiles, and contains exactly the same bugs as before. The regex 'FIXME: PID/' should reveal all markers that I left behind, including: - Incomplete conversion - Issues or things that look fishy - Actual bugs that will go wrong during runtime
2020-03-08AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)Andreas Kling
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-02-02Kernel: Start working on a syscall for logging performance eventsAndreas Kling
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. :^)