Przeglądaj źródła

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.
Tom 4 lat temu
rodzic
commit
b5437216e2

+ 1 - 1
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)

+ 1 - 0
Applications/SystemMonitor/ProcessModel.h

@@ -159,6 +159,7 @@ private:
     RefPtr<Gfx::Bitmap> m_high_priority_icon;
     RefPtr<Gfx::Bitmap> m_low_priority_icon;
     RefPtr<Gfx::Bitmap> m_normal_priority_icon;
+    RefPtr<Core::File> m_proc_all;
 };
 
 namespace AK {