mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:15:08 +00:00
ProcessManager: Rename it to SystemMonitor
This is a more appropriate name now that it does a lot more than just manage processes ^)
This commit is contained in:
parent
c7040cee62
commit
cbdda91065
23 changed files with 9 additions and 9 deletions
38
Applications/SystemMonitor/ProcessStacksWidget.cpp
Normal file
38
Applications/SystemMonitor/ProcessStacksWidget.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include "ProcessStacksWidget.h"
|
||||
#include <LibCore/CFile.h>
|
||||
#include <LibCore/CTimer.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
|
||||
ProcessStacksWidget::ProcessStacksWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
{
|
||||
set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_stacks_editor = new GTextEditor(GTextEditor::Type::MultiLine, this);
|
||||
m_stacks_editor->set_readonly(true);
|
||||
|
||||
m_timer = new CTimer(1000, [this] { refresh(); }, this);
|
||||
}
|
||||
|
||||
ProcessStacksWidget::~ProcessStacksWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void ProcessStacksWidget::set_pid(pid_t pid)
|
||||
{
|
||||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
refresh();
|
||||
}
|
||||
|
||||
void ProcessStacksWidget::refresh()
|
||||
{
|
||||
CFile file(String::format("/proc/%d/stack", m_pid));
|
||||
if (!file.open(CIODevice::ReadOnly)) {
|
||||
m_stacks_editor->set_text(String::format("Unable to open %s", file.filename().characters()));
|
||||
return;
|
||||
}
|
||||
|
||||
m_stacks_editor->set_text(file.read_all());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue