Getting Linux process resource usage (cpu,disk,network)

sethu picture sethu · Jul 8, 2011 · Viewed 22k times · Source

I want to use the /proc to find the resource usage of a particular process every second. The resources include cputime, disk usage and network usage. I looked at /proc/pid/stat , but I am not sure whether I am getting the required details. I want all 3 resource usage and I want to monitor them every second.

Answer

Alexander Sandler picture Alexander Sandler · Jul 17, 2011

Some newer kernels have /proc/<pid_of_process>/io file. This is where IO stats are. It is not documented in man proc, but you can try to figure out the numbers yourself.

Hope it helps. Alex.