1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibCore: Make ProcessStatisticsReader return results in a Vector

The HashMap API was overkill and made using this less ergonomic than
it should be.
This commit is contained in:
Andreas Kling 2021-05-23 11:08:32 +02:00
parent a345a1f4a1
commit a1e133cc6b
12 changed files with 79 additions and 83 deletions

View file

@ -328,14 +328,14 @@ void ProcessModel::update()
HashTable<int> live_tids;
u64 sum_ticks_scheduled = 0, sum_ticks_scheduled_kernel = 0;
if (all_processes.has_value()) {
for (auto& it : all_processes.value()) {
for (auto& thread : it.value.threads) {
for (auto& process : all_processes.value()) {
for (auto& thread : process.threads) {
ThreadState state;
state.kernel = it.value.kernel;
state.pid = it.value.pid;
state.user = it.value.username;
state.pledge = it.value.pledge;
state.veil = it.value.veil;
state.kernel = process.kernel;
state.pid = process.pid;
state.user = process.username;
state.pledge = process.pledge;
state.veil = process.veil;
state.syscall_count = thread.syscall_count;
state.inode_faults = thread.inode_faults;
state.zero_faults = thread.zero_faults;
@ -346,20 +346,20 @@ void ProcessModel::update()
state.ipv4_socket_write_bytes = thread.ipv4_socket_write_bytes;
state.file_read_bytes = thread.file_read_bytes;
state.file_write_bytes = thread.file_write_bytes;
state.amount_virtual = it.value.amount_virtual;
state.amount_resident = it.value.amount_resident;
state.amount_dirty_private = it.value.amount_dirty_private;
state.amount_clean_inode = it.value.amount_clean_inode;
state.amount_purgeable_volatile = it.value.amount_purgeable_volatile;
state.amount_purgeable_nonvolatile = it.value.amount_purgeable_nonvolatile;
state.amount_virtual = process.amount_virtual;
state.amount_resident = process.amount_resident;
state.amount_dirty_private = process.amount_dirty_private;
state.amount_clean_inode = process.amount_clean_inode;
state.amount_purgeable_volatile = process.amount_purgeable_volatile;
state.amount_purgeable_nonvolatile = process.amount_purgeable_nonvolatile;
state.name = thread.name;
state.executable = it.value.executable;
state.executable = process.executable;
state.ppid = it.value.ppid;
state.ppid = process.ppid;
state.tid = thread.tid;
state.pgid = it.value.pgid;
state.sid = it.value.sid;
state.pgid = process.pgid;
state.sid = process.sid;
state.ticks_user = thread.ticks_user;
state.ticks_kernel = thread.ticks_kernel;
state.cpu = thread.cpu;