Reputation: 13
I do not need to use any side tool like "iostat". I need to calculate length of the disk queue by raw data, which can be gathered from "/proc/diskstats" for example.
I investigated the source code of iostat utility to get the way it use to calculate average disk queue length. The utility uses 11-th field of "/sys/block/<device>/stat" file. This field stands for "weighted time spent doing I/Os (ms)". The utility calculates time derivative of the field. I tried to calculate it by myself and compare the result with "iostat" output. I have got different values. What a did:
Also, I tried to search sources, which could give out information about I/O operations, but I found only information about the amount of I/O operations executed in real-time. Unfortunately, it is not enough to calculate a disk queue length or an average disk queue length.
Upvotes: 0
Views: 228
Reputation: 13
Actually, my algorithm of calculation was right. I just had to make some load on disk (e.g. copy a big file) to see difference. If someone would try to compare your own result with the output of "iostat", then you better run two terminals because of convenience. One terminal for reading file "/proc/diskstats" and the other terminal for executing "iostat -x 10" (where 10 is how often data updates in seconds).
Upvotes: 0