I'm pretty sure the Linux kernel has a feature which allows to track all the reads and writes (IO) of an application and all its children however I haven't seen any utilities which can calculate it and show it.
For instance for CPU time you could simply use time
and get neat CPU use information:
$ time cat --version > /dev/null
real 0m0.001s
user 0m0.001s
sys 0m0.000s
I'm looking for something similar in regard to IO, e.g.
$ calc_io task
Bytes read: 123456
Bytes written: 0
Of course, we have /proc/$PID/io
which contains runtime information but tracking it for applications which spawn and destroy children dynamically, e.g. web-browsers seems like a daunting task. I guess if you run strace -fF firefox
then monitor all children being spawned and try to track in real time /proc/$PID/io
- nah, seems like too difficult to implement and then how often will you poll this file for information? Children may exist for a split second.
Another idea is to use cgroups
but then what if I don't want to use them? Also I've checked /sys/fs/cgroup
and I don't see any relevant statistics.
IO count delay total 0 0
- doesn't look like what I need at all. The per-task delay accounting functionality measures the delays experienced by a task while a) waiting for a CPU (while being runnable) b) completion of synchronous block I/O initiated by the taskglances
seems able to do this on disk I/O on a per second basis.