mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 05:15:07 +00:00
SystemMonitor: Update the process memory map once every second
This commit is contained in:
parent
0e34b7d65e
commit
7970b594d5
2 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue