1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 17:05:06 +00:00

SystemMonitor+LibCore: Show process pledges in SystemMonitor :^)

This commit is contained in:
Andreas Kling 2020-01-11 21:17:07 +01:00
parent 4132f713c8
commit ec1ae37f69
4 changed files with 13 additions and 0 deletions

View file

@ -93,6 +93,8 @@ String ProcessModel::column_name(int column) const
return "File In"; return "File In";
case Column::FileWriteBytes: case Column::FileWriteBytes:
return "File Out"; return "File Out";
case Column::Pledge:
return "Pledge";
default: default:
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -151,6 +153,8 @@ GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
return { 60, TextAlignment::CenterRight }; return { 60, TextAlignment::CenterRight };
case Column::IPv4SocketWriteBytes: case Column::IPv4SocketWriteBytes:
return { 60, TextAlignment::CenterRight }; return { 60, TextAlignment::CenterRight };
case Column::Pledge:
return { 60, TextAlignment::CenterLeft };
default: default:
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
@ -220,6 +224,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
return thread.current_state.file_read_bytes; return thread.current_state.file_read_bytes;
case Column::FileWriteBytes: case Column::FileWriteBytes:
return thread.current_state.file_write_bytes; return thread.current_state.file_write_bytes;
case Column::Pledge:
return thread.current_state.pledge;
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
return {}; return {};
@ -285,6 +291,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
return thread.current_state.file_read_bytes; return thread.current_state.file_read_bytes;
case Column::FileWriteBytes: case Column::FileWriteBytes:
return thread.current_state.file_write_bytes; return thread.current_state.file_write_bytes;
case Column::Pledge:
return thread.current_state.pledge;
} }
} }
@ -306,6 +314,7 @@ void ProcessModel::update()
ThreadState state; ThreadState state;
state.pid = it.value.pid; state.pid = it.value.pid;
state.user = it.value.username; state.user = it.value.username;
state.pledge = it.value.pledge;
state.syscall_count = thread.syscall_count; state.syscall_count = thread.syscall_count;
state.inode_faults = thread.inode_faults; state.inode_faults = thread.inode_faults;
state.zero_faults = thread.zero_faults; state.zero_faults = thread.zero_faults;

View file

@ -35,6 +35,7 @@ public:
CleanInode, CleanInode,
PurgeableVolatile, PurgeableVolatile,
PurgeableNonvolatile, PurgeableNonvolatile,
Pledge,
Syscalls, Syscalls,
InodeFaults, InodeFaults,
ZeroFaults, ZeroFaults,
@ -72,6 +73,7 @@ private:
String name; String name;
String state; String state;
String user; String user;
String pledge;
u32 priority; u32 priority;
u32 effective_priority; u32 effective_priority;
size_t amount_virtual; size_t amount_virtual;

View file

@ -35,6 +35,7 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
process.nfds = process_object.get("nfds").to_u32(); process.nfds = process_object.get("nfds").to_u32();
process.name = process_object.get("name").to_string(); process.name = process_object.get("name").to_string();
process.tty = process_object.get("tty").to_string(); process.tty = process_object.get("tty").to_string();
process.pledge = process_object.get("pledge").to_string();
process.amount_virtual = process_object.get("amount_virtual").to_u32(); process.amount_virtual = process_object.get("amount_virtual").to_u32();
process.amount_resident = process_object.get("amount_resident").to_u32(); process.amount_resident = process_object.get("amount_resident").to_u32();
process.amount_shared = process_object.get("amount_shared").to_u32(); process.amount_shared = process_object.get("amount_shared").to_u32();

View file

@ -37,6 +37,7 @@ struct CProcessStatistics {
unsigned nfds; unsigned nfds;
String name; String name;
String tty; String tty;
String pledge;
size_t amount_virtual; size_t amount_virtual;
size_t amount_resident; size_t amount_resident;
size_t amount_shared; size_t amount_shared;