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

Profiler: Show one timeline per process :^)

Instead of smashing together all the samples into a single timeline,
make one per process and put them all in a ScrollableContainerWidget.

This makes it much easier to see which processes were active and when.
No timeline is displayed for processes with zero samples in the profile.
This commit is contained in:
Andreas Kling 2021-05-06 18:44:31 +02:00
parent 017da44ac2
commit 9273054b2b
3 changed files with 35 additions and 4 deletions

View file

@ -24,6 +24,7 @@
#include <LibGUI/MessageBox.h>
#include <LibGUI/Model.h>
#include <LibGUI/ProcessChooser.h>
#include <LibGUI/ScrollableContainerWidget.h>
#include <LibGUI/Splitter.h>
#include <LibGUI/TabWidget.h>
#include <LibGUI/TableView.h>
@ -88,7 +89,24 @@ int main(int argc, char** argv)
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.add<ProfileTimelineWidget>(*profile);
auto timelines_widget = GUI::Widget::construct();
timelines_widget->set_layout<GUI::VerticalBoxLayout>();
timelines_widget->set_shrink_to_fit(true);
for (auto& process : profile->processes()) {
size_t event_count = 0;
for (auto& event : profile->events()) {
if (event.pid == process.pid && process.valid_at(event.timestamp))
++event_count;
}
if (!event_count)
continue;
timelines_widget->add<ProfileTimelineWidget>(*profile, process);
}
auto& scrollable_container = main_widget.add<GUI::ScrollableContainerWidget>();
scrollable_container.set_widget(timelines_widget.ptr());
main_widget.add<ProcessPickerWidget>(*profile);
auto& tab_widget = main_widget.add<GUI::TabWidget>();