Whamcloud - gitweb
LU-3154: Fix plot-sgpdd to match new sgpdd-survey output format
authorCliff White <cliffw@whamcloud.com>
Wed, 10 Apr 2013 23:29:17 +0000 (16:29 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 31 May 2013 16:40:23 +0000 (12:40 -0400)
The fields in sgpdd-survey output have changed. This updates plot-sgpdd to
work correctly. One field 'rsz' has changed from numeric to string, new
variable added to deal with that.
Fix for trailing tabs on two lines. Cleaned up tabs per Andreas.
Removed one more trailing tab.

Change-Id: I754d5fec6f6aebbc0882386d2734aa6805eb8de5
Signed-off-by: Cliff White <cliffwhi@intel.com>
Signed-off-by: Cliff White <cliffw@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/6023
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
lustre-iokit/sgpdd-survey/plot-sgpdd

index fcd4bda..f6aaa43 100755 (executable)
@@ -158,7 +158,7 @@ sub write_dat_file() {
                }
        }
        close DATAFILE;
                }
        }
        close DATAFILE;
-       &check_data_file ( $datafile );         
+       &check_data_file ( $datafile );
 }
 
 if ( !$ARGV[0] ) {
 }
 
 if ( !$ARGV[0] ) {
@@ -187,9 +187,11 @@ open ( PFILE, "$file") or die "Can't open $file";
 LABEL: while ( <PFILE> ) {
        chomp;
        @line = split( /\s+/ );
 LABEL: while ( <PFILE> ) {
        chomp;
        @line = split( /\s+/ );
-       if ($line[27] && $count != 0) {
+       # Remove the 'K' after rsz
+       $frsz = substr($line[3], 0, -1);
+       if ($line[28] && $count != 0) {
                print "invalid file format\n";
                print "invalid file format\n";
-               exit 1; 
+               exit 1;
        } 
        if ($count == 0) {
                @GraphTitle = @line;
        } 
        if ($count == 0) {
                @GraphTitle = @line;
@@ -201,10 +203,10 @@ LABEL: while ( <PFILE> ) {
                        next LABEL;
                }
        }
                        next LABEL;
                }
        }
-       if (!$rsz && $line[3]) {
-               $rsz = $line[3];
+       if (!$rsz && $frsz) {
+               $rsz = $frsz
        }
        }
-       if ($rsz != $line[3]) {
+       if ($rsz != $frsz) {
                if($readop) {
                        &write_dat_file("rd");
                        &write_scr_file("rd");
                if($readop) {
                        &write_dat_file("rd");
                        &write_scr_file("rd");
@@ -219,53 +221,52 @@ LABEL: while ( <PFILE> ) {
                        &write_dat_file("wr");
                        &write_scr_file("wr");
                }
                        &write_dat_file("wr");
                        &write_scr_file("wr");
                }
-               $rsz = $line[3];                
+               $rsz = substr($line[3],0,-1);;
                $regions = "";
                $threads = "";
        }
                $regions = "";
                $threads = "";
        }
-       #print "rg$line[5] th$line[7] w$line[9] r$line[$rindex]\n";
-       $rindex = 18;
+       $rindex = 20;
+       print "DEBUG rg$line[7] th$line[9] w$line[11] r$line[$rindex]\n";
        if ($line[18]) {
        if ($line[18]) {
-               if ($line[10] eq "failed") {
-                       $rindex = 12;
+               if ($line[12] eq "failed") {
+                       $rindex = 12;
                }
                }
-               if ($line[8] eq "write" && $line[17] eq "read") {
+               if ($line[10] eq "write" && $line[19] eq "read") {
                        $wrrd = 1;
                }
                        $wrrd = 1;
                }
-               if ($line[8] eq "read" && $line[17] eq "write") {
+               if ($line[10] eq "read" && $line[19] eq "write") {
                        $rdwr = 1;
                }
        } else {
                        $rdwr = 1;
                }
        } else {
-               if ($line[8] eq "write" && $line[9]) {
+               if ($line[10] eq "write" && $line[11]) {
                        $writeop = 1;
                }
                        $writeop = 1;
                }
-               if ($line[8] eq "read" && $line[9]) {
+               if ($line[10] eq "read" && $line[11]) {
                        $readop = 1;
                }
                        $readop = 1;
                }
-               
        }
        if ($wrrd || $rdwr) {
        }
        if ($wrrd || $rdwr) {
-               $out{$line[7]}{$line[5]} = $line[9];
+               $out{$line[9]}{$line[7]} = $line[11];
                if ($line[$rindex+1]) {
                if ($line[$rindex+1]) {
-                       if (!($line[$rindex+1] eq "failed")) {  
-                               goto LABEL2;    
+                       if (!($line[$rindex+1] eq "failed")) {
+                               goto LABEL2;
                        }
                } else {
                        }
                } else {
-LABEL2:                        if ($line[5] <= 1 ) {
-                               $out{$line[7]}{$line[5] - 1} = $line[$rindex];
+LABEL2:                        if ($line[7] <= 1 ) {
+                               $out{$line[9]}{$line[7] - 1} = $line[$rindex];
                        } else {
                        } else {
-                               $out{$line[7]}{$line[5] + 1} = $line[$rindex];
+                               $out{$line[9]}{$line[7] + 1} = $line[$rindex];
                        }
                }
        }
        if ($writeop) {
                        }
                }
        }
        if ($writeop) {
-               $out{$line[7]}{$line[5]} = $line[9];    
+               $out{$line[9]}{$line[7]} = $line[11];
        }
        if ($readop) {
        }
        if ($readop) {
-               $out{$line[7]}{$line[5]} = $line[9];
+               $out{$line[9]}{$line[7]} = $line[11];
        }
        }
-       $regions .= " $line[5]" unless $regions =~ $line[5];
-       $threads .= " $line[7]" unless $threads =~ $line[7];
+       $regions .= " $line[7]" unless $regions =~ $line[7];
+       $threads .= " $line[9]" unless $threads =~ $line[9];
        $count++;
 }
 close PFILE;
        $count++;
 }
 close PFILE;