Skip to content

Commit

Permalink
ProfileViewer: Show kernel frames with a red icon :^)
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Dec 14, 2019
1 parent f692577 commit e426702
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Binary file added Base/res/icons/16x16/inspector-object-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions DevTools/ProfileViewer/ProfileModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
m_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
m_user_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
m_kernel_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"));
}

ProfileModel::~ProfileModel()
Expand Down Expand Up @@ -90,8 +91,11 @@ GVariant ProfileModel::data(const GModelIndex& index, Role role) const
{
auto* node = static_cast<ProfileNode*>(index.internal_data());
if (role == Role::Icon) {
if (index.column() == Column::StackFrame)
return m_frame_icon;
if (index.column() == Column::StackFrame) {
if (node->address() < (8 * MB))
return m_kernel_frame_icon;
return m_user_frame_icon;
}
return {};
}
if (role == Role::Display) {
Expand Down
4 changes: 3 additions & 1 deletion DevTools/ProfileViewer/ProfileModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ class ProfileModel final : public GModel {
explicit ProfileModel(Profile&);

Profile& m_profile;
GIcon m_frame_icon;

GIcon m_user_frame_icon;
GIcon m_kernel_frame_icon;
};

0 comments on commit e426702

Please sign in to comment.