Linux – Calculating Total I/O Cost of a Process

iolinux

I know that iotop lets me measure the disk bandwidth used by any or all processes in real time. iotop -a measures the accumulated disk bandwidth, which is closer to what I want.

However, when the process I run terminates, it disappears too soon in iotop for me to be able to see exactly how many I/Os the process used in total since it started. Is there a way to record the total I/O usage of a process when it ends, and perhaps have this saved to some file for further analysis?

Note that I am only looking for answers exclusive to Linux, specifically Ubuntu.

Best Answer

Try pidstat. Use it like this: pidstat -d -e command

pidstat is able to report statistics for Linux tasks. The -d instructs pidstat to gather IO stats. pidstat will stop and print the report once the command finished.