diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-11 09:52:18 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-11 11:36:00 +0100 |
commit | 5dafb723700c798bc54515a33a3572e01a092812 (patch) | |
tree | 80692b22f17a44a171282c7c1647ce4e580b99d7 /Kernel/Thread.cpp | |
parent | f259d96871d66a4e764a43613ab0e9866a22e182 (diff) | |
download | serenity-5dafb723700c798bc54515a33a3572e01a092812.zip |
Kernel+Profiler: Make profiling per-process and without core dumps
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
Diffstat (limited to 'Kernel/Thread.cpp')
-rw-r--r-- | Kernel/Thread.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 8bb6664ff8..71283101f0 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -31,8 +31,8 @@ #include <Kernel/Arch/i386/CPU.h> #include <Kernel/FileSystem/FileDescription.h> #include <Kernel/KSyms.h> +#include <Kernel/PerformanceEventBuffer.h> #include <Kernel/Process.h> -#include <Kernel/Profiling.h> #include <Kernel/Scheduler.h> #include <Kernel/Thread.h> #include <Kernel/ThreadTracer.h> @@ -1036,7 +1036,7 @@ Vector<FlatPtr> Thread::raw_backtrace(FlatPtr ebp, FlatPtr eip) const InterruptDisabler disabler; auto& process = const_cast<Process&>(this->process()); ProcessPagingScope paging_scope(process); - Vector<FlatPtr, Profiling::max_stack_frame_count> backtrace; + Vector<FlatPtr, PerformanceEvent::max_stack_frame_count> backtrace; backtrace.append(eip); FlatPtr stack_ptr_copy; FlatPtr stack_ptr = (FlatPtr)ebp; @@ -1048,7 +1048,7 @@ Vector<FlatPtr> Thread::raw_backtrace(FlatPtr ebp, FlatPtr eip) const if (!safe_memcpy(&retaddr, (void*)(stack_ptr + sizeof(FlatPtr)), sizeof(FlatPtr), fault_at)) break; backtrace.append(retaddr); - if (backtrace.size() == Profiling::max_stack_frame_count) + if (backtrace.size() == PerformanceEvent::max_stack_frame_count) break; stack_ptr = stack_ptr_copy; } |