Volodymyr
Volodymyr

Reputation: 1597

bash - get io statistics of the child process

I have a bash process which calls another child process (mysqldump) for example. I need to determine the io usage of this child process. I tried cat /proc/self/io but values for io are connected only with the parent process. But I need the data for the child process. I can determine the pid of the child process and try view /proc/[pid of child]/io but when should I do that? If I do mysqldump and then /proc/[pid of child]/ioб /proc/[pid of child] won't exist after the finishing of the child process. Thanks!

Upvotes: 2

Views: 418

Answers (1)

Rahul
Rahul

Reputation: 77934

You can probably use strace command as below to get that result.

strace -e trace=read,write -o ls.log ls

Here, strace will give the result for ls command. If you want to attach to particular process, use the -p pid option like

strace -e trace=read,write -o ls.log -p <child process PID>

More about Strace Command Here

Upvotes: 2

Related Questions