From b5437216e23c144bc1d650cbd19ff15391497d01 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 3 Jan 2021 10:13:33 -0700 Subject: [PATCH] SystemMonitor: Re-use the /proc/all file descriptor when updating This makes it more likely to be able to get statistics when resources are scarce. --- Applications/SystemMonitor/ProcessModel.cpp | 2 +- Applications/SystemMonitor/ProcessModel.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Applications/SystemMonitor/ProcessModel.cpp b/Applications/SystemMonitor/ProcessModel.cpp index 76562481a1e178..1c9f30a0ef6e50 100644 --- a/Applications/SystemMonitor/ProcessModel.cpp +++ b/Applications/SystemMonitor/ProcessModel.cpp @@ -350,7 +350,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol void ProcessModel::update() { auto previous_pid_count = m_pids.size(); - auto all_processes = Core::ProcessStatisticsReader::get_all(); + auto all_processes = Core::ProcessStatisticsReader::get_all(m_proc_all); u64 last_sum_ticks_scheduled = 0; for (auto& it : m_threads) diff --git a/Applications/SystemMonitor/ProcessModel.h b/Applications/SystemMonitor/ProcessModel.h index 9c79d0fcc5123a..d54fecdb4b036f 100644 --- a/Applications/SystemMonitor/ProcessModel.h +++ b/Applications/SystemMonitor/ProcessModel.h @@ -159,6 +159,7 @@ class ProcessModel final : public GUI::Model { RefPtr m_high_priority_icon; RefPtr m_low_priority_icon; RefPtr m_normal_priority_icon; + RefPtr m_proc_all; }; namespace AK {