Changing `iostat -Ix' output

Mikolaj Golub trociny at FreeBSD.org
Tue Sep 18 11:15:26 UTC 2012


Hi,

I don't like very much what `iostat -Ix' outputs and would like to
change this.

A typical output:

% iostat -Ix        
                        extended device statistics  
device     r/i   w/i    kr/i    kw/i qlen svc_t  %b  
ada0     5599136.0 3953193.0 39982760.0 86819866.5    0  15.1  16 
cd0      552.0   0.0     4.3     0.0    0   0.0   0 
pass0    333.0   0.0   166.5     0.0    0   0.0   0 
pass1      2.0   0.0     1.0     0.0    0   0.0   0 

Parameters like r/i, kr/i (total io operations/kbytes) are very
useful. They allow to use `iostat -Ix' to collect IO statistics
running it periodically (from cron or some monitoring tool) and
calculate average amount of operations or bytes per second at the
specified period subtracting the current value from the previous one
and dividing by time period.

But you can't do the same with % busy, which is very useful IO
characteristics. Average % busy at the specified period could be
calculated storing total busy time for the device at time t1, total
busy time at t2 and then subtracting the last value from the first (to
get busy time at this period) and dividing by the time period.

Currently iostat(8) does not provide 'total busy time' statistics. I
use sysutils/devstat for this but it would be nice if iostat(8) itself
provide such functionality.

I propose for `iostat -Ix` to output total busy time instead of %
busy, and also total duration of transactions instead of average
duration (to be able to calculate average duration for the period
between two iostat runs).

http://people.freebsd.org/~trociny/iostat.total_busy_time.1.patch

Average duration and % busy are still available via `iostat -x`.

Here is an output example

% ./iostat -Ix; sleep 60; ./iostat -Ix
                        extended device statistics  
device           r/i         w/i         kr/i         kw/i qlen       tdur        sb  
ada0       5599785.0   3961913.0   39985960.5   86902385.5    0   144055.5   35966.5 
cd0            554.0         0.0          4.3          0.0    0        0.0       9.5 
pass0          336.0         0.0        168.0          0.0    0        0.0      17.5 
pass1            2.0         0.0          1.0          0.0    0        0.0       0.0 
                        extended device statistics  
device           r/i         w/i         kr/i         kw/i qlen       tdur        sb  
ada0       5599922.0   3963177.0   40002608.0   86958230.5    0   144074.4   35970.5 
cd0            554.0         0.0          4.3          0.0    0        0.0       9.5 
pass0          336.0         0.0        168.0          0.0    0        0.0      17.5 
pass1            2.0         0.0          1.0          0.0    0        0.0       0.0 

So, for ada0, % busy for that period was 100 * (35970.5 - 35966.5) / 60 = 6.

And service time (assuming that only read and write operations were
serviced) was

1000 * (144074.4 - 144055.5) / (5599922 - 5599785 + 3963177 - 3961913)
= 13.4 msec.

What do you think about this?

-- 
Mikolaj Golub


More information about the freebsd-hackers mailing list