summaryrefslogtreecommitdiff
path: root/DevTools/ProfileViewer/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-11 18:46:11 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-11 18:46:11 +0200
commit69583f07e0d6b17671d8ee7809811220eef6a24b (patch)
treedec55b4336afb4fc3c01b2266062f968608992a0 /DevTools/ProfileViewer/main.cpp
parent5b91d848a7f4bdb0a197acb32e16c6cdf428db83 (diff)
downloadserenity-69583f07e0d6b17671d8ee7809811220eef6a24b.zip
ProfileViewer: Add an instruction-level sample viewer
When you select a function in the profile tree, we will now display a per-instruction breakdown of aggregated samples in that function. This allows us to look much closer at what our code is doing! :^)
Diffstat (limited to 'DevTools/ProfileViewer/main.cpp')
-rw-r--r--DevTools/ProfileViewer/main.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/DevTools/ProfileViewer/main.cpp b/DevTools/ProfileViewer/main.cpp
index 4c21561240..a8625ba886 100644
--- a/DevTools/ProfileViewer/main.cpp
+++ b/DevTools/ProfileViewer/main.cpp
@@ -32,6 +32,7 @@
#include <LibGUI/Menu.h>
#include <LibGUI/MenuBar.h>
#include <LibGUI/Model.h>
+#include <LibGUI/TableView.h>
#include <LibGUI/TreeView.h>
#include <LibGUI/Window.h>
#include <stdio.h>
@@ -63,11 +64,22 @@ int main(int argc, char** argv)
main_widget.add<ProfileTimelineWidget>(*profile);
- auto& tree_view = main_widget.add<GUI::TreeView>();
+ auto& bottom_container = main_widget.add<GUI::Widget>();
+ bottom_container.set_layout<GUI::VerticalBoxLayout>();
+
+ auto& tree_view = bottom_container.add<GUI::TreeView>();
tree_view.set_headers_visible(true);
tree_view.set_size_columns_to_fit_content(true);
tree_view.set_model(profile->model());
+ auto& disassembly_view = bottom_container.add<GUI::TableView>();
+ disassembly_view.set_size_columns_to_fit_content(true);
+
+ tree_view.on_selection = [&](auto& index) {
+ profile->set_disassembly_index(index);
+ disassembly_view.set_model(profile->disassembly_model());
+ };
+
auto menubar = make<GUI::MenuBar>();
auto& app_menu = menubar->add_menu("ProfileViewer");
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app.quit(); }));