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.
This commit is contained in:
Gunnar Beutner 2021-05-18 10:17:47 +02:00 committed by Andreas Kling
parent 7dc77bd833
commit 6ac1ca5a9a
Notes: sideshowbarker 2024-07-18 17:45:31 +09:00
4 changed files with 0 additions and 34 deletions

View File

@ -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)

View File

@ -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<Process>& processes() const { return m_processes; }
template<typename Callback>
@ -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 };
};
}

View File

@ -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);
}

View File

@ -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");