mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
ProfileViewer: Add mode that shows percentages instead of sample counts
Sometimes it's much nicer to work with percentages than raw sample counts when browsing through a profile. :^)
This commit is contained in:
@@ -97,9 +97,9 @@ String ProfileModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SampleCount:
|
||||
return "# Samples";
|
||||
return m_profile.show_percentages() ? "% Samples" : "# Samples";
|
||||
case Column::SelfCount:
|
||||
return "# Self";
|
||||
return m_profile.show_percentages() ? "% Self" : "# Self";
|
||||
case Column::StackFrame:
|
||||
return "Stack Frame";
|
||||
default:
|
||||
@@ -127,10 +127,16 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, Role role) const
|
||||
return {};
|
||||
}
|
||||
if (role == Role::Display) {
|
||||
if (index.column() == Column::SampleCount)
|
||||
if (index.column() == Column::SampleCount) {
|
||||
if (m_profile.show_percentages())
|
||||
return ((float)node->event_count() / (float)m_profile.filtered_event_count()) * 100.0f;
|
||||
return node->event_count();
|
||||
if (index.column() == Column::SelfCount)
|
||||
}
|
||||
if (index.column() == Column::SelfCount) {
|
||||
if (m_profile.show_percentages())
|
||||
return ((float)node->self_count() / (float)m_profile.filtered_event_count()) * 100.0f;
|
||||
return node->self_count();
|
||||
}
|
||||
if (index.column() == Column::StackFrame)
|
||||
return node->symbol();
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user