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.
The top command (table of processes) displays the processor activity of your Linux box and also displays tasks managed by the kernel in real-time. It also shows information about CPU and memory utilization of a list of running processes.
Use ps Command to Find Top Processes by Memory and CPU Usage ps is a Linux command-line utility with many options that helps you to display output in different formats. You can use the ps command with –sort argument to sort the output by memory and CPU usage.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With