mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:57:34 +00:00
Profiler: Don't iterate all events when filtering timeline view
There is no need to iterate through all events in a profile when loading the timeline view, as soon as we see one event we can move on to the next process.
This commit is contained in:
parent
7463cbdbdb
commit
e3ee539fea
1 changed files with 6 additions and 4 deletions
|
@ -98,12 +98,14 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto timeline_view = TimelineView::construct();
|
auto timeline_view = TimelineView::construct();
|
||||||
for (auto& process : profile->processes()) {
|
for (auto& process : profile->processes()) {
|
||||||
size_t event_count = 0;
|
bool matching_event_found = false;
|
||||||
for (auto& event : profile->events()) {
|
for (auto& event : profile->events()) {
|
||||||
if (event.pid == process.pid && process.valid_at(event.timestamp))
|
if (event.pid == process.pid && process.valid_at(event.timestamp)) {
|
||||||
++event_count;
|
matching_event_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!event_count)
|
if (!matching_event_found)
|
||||||
continue;
|
continue;
|
||||||
auto& timeline_header = timeline_header_container->add<TimelineHeader>(*profile, process);
|
auto& timeline_header = timeline_header_container->add<TimelineHeader>(*profile, process);
|
||||||
timeline_header.set_shrink_to_fit(true);
|
timeline_header.set_shrink_to_fit(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue