1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

SystemMonitor: Show PPID, PGID, SID

With this information, it's a bit easier to intuit the current 'process tree'.
If you're reading this, can I convince you to implement a nice process tree for
SystemMonitor? It could be via PPID (unbounded depth), or SID+PGID (depth 3).
Or something else entirely :D
This commit is contained in:
Ben Wiederhake 2020-08-09 21:44:40 +02:00 committed by Andreas Kling
parent dbbdb39c1f
commit 81b491a7a4
2 changed files with 31 additions and 1 deletions

View file

@ -90,6 +90,12 @@ String ProcessModel::column_name(int column) const
return "PID"; return "PID";
case Column::TID: case Column::TID:
return "TID"; return "TID";
case Column::PPID:
return "PPID";
case Column::PGID:
return "PGID";
case Column::SID:
return "SID";
case Column::State: case Column::State:
return "State"; return "State";
case Column::User: case Column::User:
@ -165,6 +171,9 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const
return Gfx::TextAlignment::CenterLeft; return Gfx::TextAlignment::CenterLeft;
case Column::PID: case Column::PID:
case Column::TID: case Column::TID:
case Column::PPID:
case Column::PGID:
case Column::SID:
case Column::Priority: case Column::Priority:
case Column::EffectivePriority: case Column::EffectivePriority:
case Column::Virtual: case Column::Virtual:
@ -202,6 +211,12 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const
return thread.current_state.pid; return thread.current_state.pid;
case Column::TID: case Column::TID:
return thread.current_state.tid; return thread.current_state.tid;
case Column::PPID:
return thread.current_state.ppid;
case Column::PGID:
return thread.current_state.pgid;
case Column::SID:
return thread.current_state.sid;
case Column::State: case Column::State:
return thread.current_state.state; return thread.current_state.state;
case Column::User: case Column::User:
@ -273,6 +288,12 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const
return thread.current_state.pid; return thread.current_state.pid;
case Column::TID: case Column::TID:
return thread.current_state.tid; return thread.current_state.tid;
case Column::PPID:
return thread.current_state.ppid;
case Column::PGID:
return thread.current_state.pgid;
case Column::SID:
return thread.current_state.sid;
case Column::State: case Column::State:
return thread.current_state.state; return thread.current_state.state;
case Column::User: case Column::User:
@ -366,7 +387,10 @@ void ProcessModel::update()
state.name = thread.name; state.name = thread.name;
state.ppid = it.value.ppid;
state.tid = thread.tid; state.tid = thread.tid;
state.pgid = it.value.pgid;
state.sid = it.value.sid;
state.times_scheduled = thread.times_scheduled; state.times_scheduled = thread.times_scheduled;
state.cpu = thread.cpu; state.cpu = thread.cpu;
state.priority = thread.priority; state.priority = thread.priority;

View file

@ -57,6 +57,9 @@ public:
User, User,
PID, PID,
TID, TID,
PPID,
PGID,
SID,
Virtual, Virtual,
Physical, Physical,
DirtyPrivate, DirtyPrivate,
@ -107,8 +110,11 @@ private:
ProcessModel(); ProcessModel();
struct ThreadState { struct ThreadState {
int tid; pid_t tid;
pid_t pid; pid_t pid;
pid_t ppid;
pid_t pgid;
pid_t sid;
unsigned times_scheduled; unsigned times_scheduled;
String name; String name;
String state; String state;