mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
ProfileViewer: Begin work on a visualization tool for profiles :^)
We begin with a simple treeview that shows a recorded profile. To record and view a profile of a process with <PID>, simply do this: $ profile <PID> on ... wait while PID does something interesting ... $ profile <PID> off $ cat /proc/profile > my-profile.prof $ ProfileViewer my-profile.prof
This commit is contained in:
parent
0f393148da
commit
19d8c675f1
Notes:
sideshowbarker
2024-07-19 10:52:43 +09:00
Author: https://github.com/awesomekling
Commit: 19d8c675f1
8 changed files with 350 additions and 0 deletions
33
DevTools/ProfileViewer/main.cpp
Normal file
33
DevTools/ProfileViewer/main.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "Profile.h"
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GTreeView.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("usage: %s <profile-file>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto profile = Profile::load_from_file(argv[1]);
|
||||
if (!profile) {
|
||||
fprintf(stderr, "Unable to load profile '%s'\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
GApplication app(argc, argv);
|
||||
|
||||
auto window = GWindow::construct();
|
||||
window->set_title("ProfileViewer");
|
||||
window->set_rect(100, 100, 800, 600);
|
||||
|
||||
auto tree_view = GTreeView::construct(nullptr);
|
||||
tree_view->set_model(profile->model());
|
||||
|
||||
window->set_main_widget(tree_view);
|
||||
|
||||
window->show();
|
||||
return app.exec();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue