How to get the system ioWait

iowait, linux

Solution

This is available in `/proc/stat`.

From the documentation in the kernel source:

The very first "cpu" line aggregates the numbers in all of the other "cpuN" lines. These numbers identify the amount of time the CPU has spent performing different kinds of work. Time units are in USER_HZ (typically hundredths of a second). The meanings of the columns are as follows, from left to right:

- user: normal processes executing in user mode

- nice: niced processes executing in user mode

- system: processes executing in kernel mode

- idle: twiddling thumbs

- iowait: waiting for I/O to complete

- irq: servicing interrupts

- softirq: servicing softirqs

- steal: involuntary wait

Problem

How can i get the systems ioWait? This would be preferable by using info the /proc interface( i guess its written somewhere in there) so an app could detect this, but an external call to exec() from my app would be acceptable.

Original source