summaryrefslogtreecommitdiff
path: root/Userland/DevTools/Profiler/Profile.cpp
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-13 22:11:44 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-14 00:35:57 +0200
commitd6b3513aabbf1f34eb5232517cb612ca0b7cbc9d (patch)
tree8a8ca7b3a252fbbb502667f7b325503e9e2beb8d /Userland/DevTools/Profiler/Profile.cpp
parentc534f176bc1d0f2d89c90e9e7320e4782eaba833 (diff)
downloadserenity-d6b3513aabbf1f34eb5232517cb612ca0b7cbc9d.zip
Profiler: Let the user ignore context switches
Now that the profiling timer is independent from the scheduler the user will get quite a few CPU samples from "within" the scheduler. These events are less useful when just profiling a user-mode process rather than the whole system. This patch adds an option to Profiler to hide these events.
Diffstat (limited to 'Userland/DevTools/Profiler/Profile.cpp')
-rw-r--r--Userland/DevTools/Profiler/Profile.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index fa06bcebe3..35fb6814ff 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -99,6 +99,12 @@ void Profile::rebuild_tree()
if (!process_filter_contains(event.pid, event.timestamp))
continue;
+ if (!m_show_scheduler && !event.frames.is_empty()) {
+ auto top_frame = event.frames[event.frames.size() - 1];
+ if (top_frame.symbol == "Kernel::Scheduler::yield()")
+ continue;
+ }
+
m_filtered_event_indices.append(event_index);
if (event.type == "malloc" && !live_allocations.contains(event.ptr))
@@ -450,6 +456,15 @@ void Profile::set_show_percentages(bool show_percentages)
m_show_percentages = show_percentages;
}
+void Profile::set_show_scheduler(bool show_scheduler)
+{
+ if (m_show_scheduler == show_scheduler)
+ return;
+ m_show_scheduler = show_scheduler;
+ // FIXME: This only works when kernel symbols are available
+ rebuild_tree();
+}
+
void Profile::set_disassembly_index(const GUI::ModelIndex& index)
{
if (m_disassembly_index == index)