I know that the proc/diskstats file presents these data columns:
1 - major number 2 - minor mumber 3 - device name 4 - reads completed successfully 5 - reads merged 6 - sectors read 7 - time spent reading (ms) 8 - writes completed 9 - writes merged 10 - sectors written 11 - time spent writing (ms) 12 - I/Os currently in progress 13 - time spent doing I/Os (ms) 14 - weighted time spent doing I/Os (ms)
Now I want to know if there is any way to get the instant transfer rate for read and write of a hard drive.
Is it right if I divide completed reads(column 4) divided by time spent reading(column 7) to get the read instant speed? The same would happen for the writes with different columns I suppose.
In another words, I am looking for a way to calculate the amount of data read from the device and the amount of data written to the device like on ubuntu's iostat man page(kB_read/s and kB_wrtn/s columns).
This solution seems to me like a long time average, it's not instant speed... am I right?
Waiting some hints :) thank you