sdxx to cxtxdx conversion for IO latency by colour DTrace script

A couple of people commented that they would like a format of c0t0d0 rather than sd0 for the script in I/O latency by colour script I posted a few weeks ago.

So, change the line

       @[args[1]->dev_pathname] = lquantize(this->elapsed / MS, 0, 200, 50);
to
       @[args[1]->dev_statname] = lquantize(this->elapsed / MS, 0, 200, 50);
The DTrace IO provider does not appear to provide the format cxtxdx(if you know different, please add a comment), so a bit of klunky post processing is needed.
#!/usr/bin/perl -w

use strict;
my %regex= ();

system("iostat -E | awk '/Soft/ { print \\$1}' > /tmp/a");
system("iostat -En | awk '/Soft/ { print \\$1 }' > /tmp/b");
system("paste /tmp/a /tmp/b > /tmp/c");

open(F, "/tmp/c") || die ("no /tmp/c");
while() {
    my ($sd,$ctd) = split;
    $regex{$sd} = $ctd;
}
close(F);

while (<>) {
    for my $sd (keys %regex) {
         s/$sd\\b/$regex{$sd}/g;
    }
    print;
}
Then run as
 pfexec dtrace -s ./io_latency_by_colour.d | ./sd_to_cxtxdx.pl
and enjoy the colours and the easier to read disk format. I shall have to talk to Brother Jon to determine if an addition to the IO provider makes sense, though given the amount of work iostat goes through to get this format, might explain why its not already part if the IO provider.
Comments:

Post a Comment:
Comments are closed for this entry.
About

clive

Search

Categories
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today