mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:15:06 +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
|
@ -69,6 +69,7 @@ GUI::Model& Profile::model()
|
|||
|
||||
void Profile::rebuild_tree()
|
||||
{
|
||||
u32 filtered_event_count = 0;
|
||||
Vector<NonnullRefPtr<ProfileNode>> roots;
|
||||
|
||||
auto find_or_create_root = [&roots](const String& symbol, u32 address, u32 offset, u64 timestamp) -> ProfileNode& {
|
||||
|
@ -146,10 +147,13 @@ void Profile::rebuild_tree()
|
|||
node->increment_self_count();
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
++filtered_event_count;
|
||||
}
|
||||
|
||||
sort_profile_nodes(roots);
|
||||
|
||||
m_filtered_event_count = filtered_event_count;
|
||||
m_roots = move(roots);
|
||||
m_model->update();
|
||||
}
|
||||
|
@ -276,3 +280,10 @@ void Profile::set_inverted(bool inverted)
|
|||
m_inverted = inverted;
|
||||
rebuild_tree();
|
||||
}
|
||||
|
||||
void Profile::set_show_percentages(bool show_percentages)
|
||||
{
|
||||
if (m_show_percentages == show_percentages)
|
||||
return;
|
||||
m_show_percentages = show_percentages;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue