mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 18:45:08 +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:
parent
8effe0b632
commit
058cd1241e
4 changed files with 37 additions and 4 deletions
|
@ -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 {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue