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

Profiler: Implement "Top functions" feature like Instruments.app has

This view mode takes every stack frame and turns it into a root in the
profile graph. This allows functions that are called from many places
to bubble up to the top. It's a very handy way to discover heavy things
in a profile that are otherwise obscured by having many callers.
This commit is contained in:
Andreas Kling 2020-10-19 15:04:54 +02:00
parent 46cc1f718e
commit be4005cb9e
3 changed files with 83 additions and 19 deletions

View file

@ -107,12 +107,19 @@ int main(int argc, char** argv)
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); }));
auto& view_menu = menubar->add_menu("View");
auto invert_action = GUI::Action::create_checkable("Invert tree", { Mod_Ctrl, Key_I }, [&](auto& action) {
profile->set_inverted(action.is_checked());
});
invert_action->set_checked(false);
view_menu.add_action(invert_action);
auto top_functions_action = GUI::Action::create_checkable("Top functions", { Mod_Ctrl, Key_T }, [&](auto& action) {
profile->set_show_top_functions(action.is_checked());
});
top_functions_action->set_checked(false);
view_menu.add_action(top_functions_action);
auto percent_action = GUI::Action::create_checkable("Show percentages", { Mod_Ctrl, Key_P }, [&](auto& action) {
profile->set_show_percentages(action.is_checked());
tree_view.update();