summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/SystemMonitor/ProcessMemoryMapWidget.cpp8
-rw-r--r--Applications/SystemMonitor/ProcessMemoryMapWidget.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
index a30f7f9d98..8b592a5999 100644
--- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
+++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
@@ -1,4 +1,5 @@
#include "ProcessMemoryMapWidget.h"
+#include <LibCore/CTimer.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GJsonArrayModel.h>
#include <LibGUI/GTableView.h>
@@ -30,6 +31,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GWidget* parent)
});
pid_vm_fields.empend("name", "Name", TextAlignment::CenterLeft);
m_table_view->set_model(GJsonArrayModel::create({}, move(pid_vm_fields)));
+ m_timer = CTimer::construct(1000, [this] { refresh(); }, this);
}
ProcessMemoryMapWidget::~ProcessMemoryMapWidget()
@@ -43,3 +45,9 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid)
m_pid = pid;
static_cast<GJsonArrayModel*>(m_table_view->model())->set_json_path(String::format("/proc/%d/vm", pid));
}
+
+void ProcessMemoryMapWidget::refresh()
+{
+ if (m_pid != -1)
+ m_table_view->model()->update();
+}
diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.h b/Applications/SystemMonitor/ProcessMemoryMapWidget.h
index db09ddc454..8d4081635b 100644
--- a/Applications/SystemMonitor/ProcessMemoryMapWidget.h
+++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.h
@@ -2,6 +2,7 @@
#include <LibGUI/GWidget.h>
+class CTimer;
class GTableView;
class ProcessMemoryMapWidget final : public GWidget {
@@ -10,9 +11,11 @@ public:
virtual ~ProcessMemoryMapWidget() override;
void set_pid(pid_t);
+ void refresh();
private:
explicit ProcessMemoryMapWidget(GWidget* parent);
RefPtr<GTableView> m_table_view;
pid_t m_pid { -1 };
+ RefPtr<CTimer> m_timer;
};