What are the advantages of using `pidstat` for per-process monitoring compared to `top` and `iotop`? How can you use `pidstat` to monitor CPU, memory, and disk usage over time for a specific process? Provide an example command.
In top and iotop, the display refreshes over time, where each update erases the previous output. The pidstat utility allows you to see the resource consumption of a process over time in the style of vmstat. We can monitor memory usage using -r and disk usage using -d. For e.g pidstat -r it lists the memory usage by all the processes and pidstat - d lists the disk usage by all the processes.
While monitoring specific processes using `top` and `iotop` , the display refreshes over time and each update erase the previous output.
pidstat utility allows you to see the resource consumption of a process over time in the style of vmstat.
Although pidstat shows CPU utilization by default,we can use -r option to monitor memory and -d to turn on disk monitoring by using -p for specific process id.
Monitor specific process with utilities eg top and iotop. This is display refreshes over time, and each update erases the previous output. The pidstat utilities allows you to see the resources consumption of a process over time in the style of vmstat. Eg You can use the -r option to monitor memory and -d to turn on disk monitoring. pidstat(1) manual page to see more option like thread, context switching..