1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

Kernel+Profiler: Capture metadata about all profiled processes

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! :^)
This commit is contained in:
Andreas Kling 2021-03-02 19:01:02 +01:00
parent ea500dd3e3
commit 5e7abea31e
Notes: sideshowbarker 2024-07-18 21:45:59 +09:00
11 changed files with 223 additions and 102 deletions

View file

@ -75,15 +75,25 @@ public:
return const_cast<PerformanceEventBuffer&>(*this).at(index);
}
OwnPtr<KBuffer> to_json(ProcessID, const String& executable_path) const;
bool to_json(KBufferBuilder&, ProcessID, const String& executable_path) const;
bool to_json(KBufferBuilder&) const;
// Used by full-system profile (/proc/profile)
bool to_json(KBufferBuilder&);
void add_process(const Process&);
private:
explicit PerformanceEventBuffer(NonnullOwnPtr<KBuffer>);
struct SampledProcess {
ProcessID pid;
String executable;
HashTable<ThreadID> threads;
struct Region {
String name;
Range range;
};
Vector<Region> regions;
};
template<typename Serializer>
bool to_json_impl(Serializer&) const;
@ -91,6 +101,8 @@ private:
size_t m_count { 0 };
NonnullOwnPtr<KBuffer> m_buffer;
HashMap<ProcessID, NonnullOwnPtr<SampledProcess>> m_processes;
};
}