From 6ac1ca5a9afbc900a483a1c528eb4b1c62a1c67e Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 18 May 2021 10:17:47 +0200 Subject: [PATCH] Profiler: Remove ability to filter Kernel::Scheduler::yield() frames Hiding those frames doesn't really make sense. They're a major contributor to a process' spent CPU time and show up in a lot of profiles. That however is because those processes really do spend quite a bit of time in the scheduler by doing lots of context switches, like WindowServer when responding to IPC calls. Instead of hiding these for aesthetic reasons we should instead improve the scheduler. --- Userland/DevTools/Profiler/Profile.cpp | 15 --------------- Userland/DevTools/Profiler/Profile.h | 4 ---- Userland/DevTools/Profiler/TimelineTrack.cpp | 6 ------ Userland/DevTools/Profiler/main.cpp | 9 --------- 4 files changed, 34 deletions(-) diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index c525d7972b..2c6f17f170 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -99,12 +99,6 @@ void Profile::rebuild_tree() if (!process_filter_contains(event.pid, event.timestamp)) continue; - if (!m_show_scheduler && !event.frames.is_empty()) { - const auto& top_frame = event.frames[event.frames.size() - 1]; - if (top_frame.symbol == "Kernel::Scheduler::yield()"sv) - continue; - } - m_filtered_event_indices.append(event_index); if (event.type == "malloc"sv && !live_allocations.contains(event.ptr)) @@ -459,15 +453,6 @@ 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) diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 05292dd87c..799ff267ec 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -197,9 +197,6 @@ public: bool show_percentages() const { return m_show_percentages; } void set_show_percentages(bool); - bool show_scheduler() const { return m_show_scheduler; } - void set_show_scheduler(bool); - const Vector& processes() const { return m_processes; } template @@ -244,7 +241,6 @@ private: bool m_inverted { false }; bool m_show_top_functions { false }; bool m_show_percentages { false }; - bool m_show_scheduler { true }; }; } diff --git a/Userland/DevTools/Profiler/TimelineTrack.cpp b/Userland/DevTools/Profiler/TimelineTrack.cpp index 6f430bed36..e04934e0d4 100644 --- a/Userland/DevTools/Profiler/TimelineTrack.cpp +++ b/Userland/DevTools/Profiler/TimelineTrack.cpp @@ -71,12 +71,6 @@ void TimelineTrack::paint_event(GUI::PaintEvent& event) if (!m_process.valid_at(event.timestamp)) continue; - if (!m_profile.show_scheduler() && !event.frames.is_empty()) { - const auto& top_frame = event.frames[event.frames.size() - 1]; - if (top_frame.symbol == "Kernel::Scheduler::yield()"sv) - continue; - } - auto& histogram = event.in_kernel ? kernel_histogram : usermode_histogram; histogram.insert(clamp_timestamp(event.timestamp), 1 + event.lost_samples); } diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index bc05a18865..ece4ba2320 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -209,15 +209,6 @@ int main(int argc, char** argv) percent_action->set_checked(false); view_menu.add_action(percent_action); - auto scheduler_action = GUI::Action::create_checkable("Show &Context Switches", { Mod_Ctrl, Key_C }, [&](auto& action) { - profile->set_show_scheduler(action.is_checked()); - tree_view.update(); - disassembly_view.update(); - timeline_container.update(); - }); - scheduler_action->set_checked(true); - view_menu.add_action(scheduler_action); - auto& help_menu = menubar->add_menu("&Help"); help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help");