Total network data sent/received of a non-daemon Linux process?
- by leden
I'm looking for a simple and effective way of measuring total bytes received/sent from a single process upon its termination.
Basically, I am looking for a tool which has the interface similar to "time" and "/usr/bin/time", e.g.
measure-net-data <prog_to_run> <prog_args>
Received (b): XYZ
Sent (b): ABC
I know that there are many tools for bandwidth/network monitoring, but as far I can tell all of them are performing the measurements it real-time, which is inappropriate not only because of overhead but also because of the inconvenience - I would need to stop the program, capture the output of the tool and then kill it.
I have seen that newer versions of Linux 2.6.20+ provide /proc/<pid>/io/ which contain the information I'm looking for; however, everything under /proc/<pid> when the process terminates, so I'm again back to the same problem as with any network monitoring tool.