1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 18:28:10 +00: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
11 changed files with 223 additions and 102 deletions

View file

@ -57,6 +57,10 @@ String SamplesModel::column_name(int column) const
return "#";
case Column::Timestamp:
return "Timestamp";
case Column::ThreadID:
return "TID";
case Column::ExecutableName:
return "Executable";
case Column::InnermostStackFrame:
return "Innermost Frame";
default:
@ -77,6 +81,16 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
if (index.column() == Column::SampleIndex)
return event_index;
if (index.column() == Column::ThreadID)
return event.tid;
if (index.column() == Column::ExecutableName) {
// FIXME: More abuse of the PID/TID relationship:
if (auto* process = m_profile.find_process(event.tid))
return process->executable;
return "";
}
if (index.column() == Column::Timestamp) {
return (u32)event.timestamp;
}