1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +00:00

Profiler: Split the call tree into one subtree per process

This patch adds an additional level of hierarchy to the call tree:
Every process gets its own top-level node. :^)

Before this, selecting multiple processes would get quite confusing
as all the call stacks from different processes were combined together
into one big tree.
This commit is contained in:
Andreas Kling 2021-05-22 21:22:23 +02:00
parent 65a341b82f
commit 8a5c78e93b
5 changed files with 49 additions and 27 deletions

View file

@ -7,6 +7,7 @@
#include "ProfileModel.h"
#include "Profile.h"
#include <AK/StringBuilder.h>
#include <LibGUI/FileIconProvider.h>
#include <ctype.h>
#include <stdio.h>
@ -101,6 +102,9 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
}
if (role == GUI::ModelRole::Icon) {
if (index.column() == Column::StackFrame) {
if (node->is_root()) {
return GUI::FileIconProvider::icon_for_executable(node->process().executable);
}
if (node->address() >= 0xc0000000)
return m_kernel_frame_icon;
return m_user_frame_icon;
@ -120,8 +124,12 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
}
if (index.column() == Column::ObjectName)
return node->object_name();
if (index.column() == Column::StackFrame)
if (index.column() == Column::StackFrame) {
if (node->is_root()) {
return String::formatted("{} ({})", node->process().basename, node->process().pid);
}
return node->symbol();
}
return {};
}
return {};