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

Kernel: Start work on full system profiling :^)

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
This commit is contained in:
Andreas Kling 2021-03-02 17:19:35 +01:00
parent b425c2602c
commit ea500dd3e3
5 changed files with 91 additions and 23 deletions

View file

@ -78,9 +78,15 @@ public:
OwnPtr<KBuffer> to_json(ProcessID, const String& executable_path) const;
bool to_json(KBufferBuilder&, ProcessID, const String& executable_path) const;
// Used by full-system profile (/proc/profile)
bool to_json(KBufferBuilder&);
private:
explicit PerformanceEventBuffer(NonnullOwnPtr<KBuffer>);
template<typename Serializer>
bool to_json_impl(Serializer&) const;
PerformanceEvent& at(size_t index);
size_t m_count { 0 };