Whamcloud - gitweb
Added scripts to parse output per Peter Braam
[fs/lustre-release.git] / lustre-iokit / obdfilter-survey / obparse.pl
1 #!/usr/bin/perl -w
2
3 # parses obdfilter output from our script goop
4 # arg 0 input filename
5 # arg 1 is 'w' 'r'
6
7 $file = $ARGV[0];
8
9 $type = $ARGV[1];
10 print "$file\n";
11
12
13 open ( PFILE, "$file") or die "Can't open results";
14 while ( <PFILE> ) {
15         chomp;
16         @line = split( /\s+/ );
17         if ( $type eq 'w' ) {
18                 # print "$line[5] $line[7] $line[9]\n";
19                 # if( $line[9]) {
20                 $out{$line[7]}{$line[9]} = $line[11];   
21                 # }
22         } elsif ( $type eq 'r' ) {
23                 # if( $line[18]) {
24                 # print "$line[5] $line[7] $line[18]\n";
25                 $out{$line[7]}{$line[9]} = $line[21];   
26         } else {
27                 # if( $line[18]) {
28                 # print "$line[5] $line[7] $line[18]\n";
29                 $out{$line[7]}{$line[9]} = $line[16];   
30         }
31 }
32
33         foreach $crg ( sort { $a <=> $b }  ( keys %out )) {
34                 print "$crg";
35                 @list = ( sort { $a <=> $b } ( keys %{ $out{$crg} } ));
36                  foreach $thr ( @list ) {
37                         # These are the headers
38                          print ",$thr";
39                  }
40                  print "\n";
41                  print "$crg";
42                  foreach $tthr ( @list ) {
43                          print ",$out{$crg}{$tthr}";
44                  }
45                 print "\n";
46         }
47         
48