per process IO stats

This commit is contained in:
Jos Dehaes 2021-10-08 09:32:06 +02:00
parent c8b50ed488
commit f98606c6db

View file

@ -953,7 +953,6 @@ namespace Proc {
}
//? Expand process status from single char to explanative string
Logger::debug("pid " + std::to_string(pid) + string(":") + std::to_string(detailed.entry.state));
detailed.status = get_status(detailed.entry.state);
if (detailed.memory.empty()) {
@ -966,6 +965,13 @@ namespace Proc {
}
while (cmp_greater(detailed.mem_bytes.size(), width)) detailed.mem_bytes.pop_front();
rusage_info_current rusage;
if (proc_pid_rusage(pid, RUSAGE_INFO_CURRENT, (void **)&rusage) == 0) {
// this fails for processes we don't own
detailed.io_read = floating_humanizer(rusage.ri_diskio_bytesread);
detailed.io_write = floating_humanizer(rusage.ri_diskio_byteswritten);
}
}
//* Collects and sorts process information from /proc