diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-02 19:01:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-02 22:38:06 +0100 |
commit | 5e7abea31e447f234e18d933e3421fc204009fcc (patch) | |
tree | 93d2662dfffd7ed9b338af1d145899f20fa1201d /Userland/DevTools/Profiler/SamplesModel.cpp | |
parent | ea500dd3e31f531212af2e9a33ff40f26de48594 (diff) | |
download | serenity-5e7abea31e447f234e18d933e3421fc204009fcc.zip |
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! :^)
Diffstat (limited to 'Userland/DevTools/Profiler/SamplesModel.cpp')
-rw-r--r-- | Userland/DevTools/Profiler/SamplesModel.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index 79159ddc3a..3daac16bd1 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -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; } |