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
Notes: sideshowbarker 2024-07-19 10:10:34 +09:00
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";
case Column::FileWriteBytes:
return "File Out";
case Column::Pledge:
return "Pledge";
default:
ASSERT_NOT_REACHED();
}
@ -151,6 +153,8 @@ GModel::ColumnMetadata ProcessModel::column_metadata(int column) const
return { 60, TextAlignment::CenterRight };
case Column::IPv4SocketWriteBytes:
return { 60, TextAlignment::CenterRight };
case Column::Pledge:
return { 60, TextAlignment::CenterLeft };
default:
ASSERT_NOT_REACHED();
}
@ -220,6 +224,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
return thread.current_state.file_read_bytes;
case Column::FileWriteBytes:
return thread.current_state.file_write_bytes;
case Column::Pledge:
return thread.current_state.pledge;
}
ASSERT_NOT_REACHED();
return {};
@ -285,6 +291,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
return thread.current_state.file_read_bytes;
case Column::FileWriteBytes:
return thread.current_state.file_write_bytes;
case Column::Pledge:
return thread.current_state.pledge;
}
}
@ -306,6 +314,7 @@ void ProcessModel::update()
ThreadState state;
state.pid = it.value.pid;
state.user = it.value.username;
state.pledge = it.value.pledge;
state.syscall_count = thread.syscall_count;
state.inode_faults = thread.inode_faults;
state.zero_faults = thread.zero_faults;

View file

@ -35,6 +35,7 @@ public:
CleanInode,
PurgeableVolatile,
PurgeableNonvolatile,
Pledge,
Syscalls,
InodeFaults,
ZeroFaults,
@ -72,6 +73,7 @@ private:
String name;
String state;
String user;
String pledge;
u32 priority;
u32 effective_priority;
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.name = process_object.get("name").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_resident = process_object.get("amount_resident").to_u32();
process.amount_shared = process_object.get("amount_shared").to_u32();

View file

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