So, what value should we read to get the in out operations per second per process?

I've tried /proc/[pid]/io which returns these values:

root@node:~# cat /proc/31597/io
rchar: 213260190
wchar: 462308212
syscr: 23275044
syscw: 47797624
read_bytes: 894867968
write_bytes: 27645691392
cancelled_write_bytes: 0

From definition:

syscr, syscw - Counters for number of I/O operation (respectively: read and write). We may use then to compute average amount of data passed in one system call.

So, I think last value of syscw minus the previous value of syscw after a second should give me the write operation count that has been performed by process 31597

However, when the process is doing around 5MB/sec writes (small files), I get the value as 6500 IOPS for writing and that doesn't look correct to me.

Any ideas?

share|improve this question
    
Thats the number of read/write syscalls, these dont translate to IOPs, especially when the reads come from page cache and writes go to dirty writeback. – Matthew Ife Apr 4 '14 at 18:11
    
Any possibility to get the actual IOPS? – ispirto Apr 4 '14 at 18:21
    
Not unless you write with direct IO (O_DIRECT), then you can divide wchar by the device sector size. Otherwise it makes little sense to measure IOPS per-process, because all the writes get bundled into writeback or fetched from pagecache. If you only care about what really lands on disk you can use iotop or pidstat -d to obtain pid statistics. – Matthew Ife Apr 4 '14 at 18:27

iotop can be the program you are looking for. It is like top, but for I/O.

You need a 2.6.20 or better kernel and root privileges.

share|improve this answer
4  
I'm not looking for the byte count. I'm looking for the operation count. – ispirto Apr 4 '14 at 18:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.