What would be Linux equivalent of GetProcessIoCounters?
-
03-07-2019 - |
Question
Here's a link to Windows documentation.
Basically I would like to get similar data, but on Linux. If not all is possible, then at least some parts.
Solution
If you enable CONFIG\_TASK\_IO\_ACCOUNTING
, you will have the information available in /proc/<pid>/io. This is available since kernel 2.6.20, but not normally enabled by default (However, in Ubuntu 8.04 it seems like it is enabled).
You can read about the various data items in Documentation/filesystems/proc.txt in the kernel source tree. Especially section 2.14 should be of interest.
OTHER TIPS
Have a look at /proc/
PID/io
- it's the current I/O accounting information of the process with PID.
Look at the pseudo-files under /proc/<PID>/
. Maybe you can find what you need there.
Look at man 5 proc
, or failing that the kernel documentation. However, I don't see much that looks promising. Sorry.
Perhaps you want getrusage()? Not all fields are maintained under linux however. Perhaps enabling the CONFIG_TASK_IO_ACCOUNTING
will cause them to be maintained?