How to get I/O usage by process in Unix?

6

1

Possible Duplicate:
Linux: Is there something similar to "top" for I/O?

I am trying to do some CPU intensive operation on a Linux machine and it is showing very high load.

I want to figure out if this load is due to I/O or CPU usage. How could I get the percentage of I/O usage by process?

samarth

Posted 2011-08-10T09:32:14.063

Reputation: 161

Question was closed 2011-08-10T19:19:10.037

Answers

6

Try program called "iotop". It shows usage of local disk drives in similar way than "top" for CPU usage. For network traffic there's a tool called "iftop".

Also, if you are uncertain about why the load is high, look at the "IO Wait" column on "top" view. If the CPU time mainly goes to "user" or "system" work, then it's CPU that's the bottleneck, if "IO wait", then disk. Also worth looking are swap numbers - if the physical memory has less than 5% free and/or lot of swap file is used, you might be limited by physical memory.

For example:

top - 17:18:37 up 1 day,  5:20, 19 users,  load average: 0.18, 0.26, 0.35
Tasks: 249 total,   2 running, 246 sleeping,   0 stopped,   1 zombie
Cpu(s):  8.5%us,  2.1%sy,  0.3%ni, 85.4%id,  3.7%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   8183668k total,  8082464k used,   101204k free,    11148k buffers
Swap: 11847900k total,   248528k used, 11599372k free,  3361444k cached

"us" stands for userspace code, "sy" for system, "id" for idle, "wa" for IO wait.

Zds

Posted 2011-08-10T09:32:14.063

Reputation: 2 209

0

Take a look at the Linux proc fs

sternr

Posted 2011-08-10T09:32:14.063

Reputation: 101

0

To start with, you can run top and look at the total CPU usage in the third line of the display. If the load averages in the first line are high, but the CPU usage in the third line is low, then the problem is I/O usage. To narrow it down more specifically from there you can then use iotop, like Zds suggested.

Ken Bloom

Posted 2011-08-10T09:32:14.063

Reputation: 489