From 41b6a536a0828a262f2f809c39cdf2d82ddb147e Mon Sep 17 00:00:00 2001 From: Cliff White Date: Wed, 10 Apr 2013 16:29:17 -0700 Subject: [PATCH] LU-3154: Fix plot-sgpdd to match new sgpdd-survey output format 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 Signed-off-by: Cliff White Reviewed-on: http://review.whamcloud.com/6023 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Keith Mannthey --- lustre-iokit/sgpdd-survey/plot-sgpdd | 53 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/lustre-iokit/sgpdd-survey/plot-sgpdd b/lustre-iokit/sgpdd-survey/plot-sgpdd index fcd4bda..f6aaa43 100755 --- a/lustre-iokit/sgpdd-survey/plot-sgpdd +++ b/lustre-iokit/sgpdd-survey/plot-sgpdd @@ -158,7 +158,7 @@ sub write_dat_file() { } } close DATAFILE; - &check_data_file ( $datafile ); + &check_data_file ( $datafile ); } if ( !$ARGV[0] ) { @@ -187,9 +187,11 @@ open ( PFILE, "$file") or die "Can't open $file"; LABEL: while ( ) { 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"; - exit 1; + exit 1; } if ($count == 0) { @GraphTitle = @line; @@ -201,10 +203,10 @@ LABEL: while ( ) { 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"); @@ -219,53 +221,52 @@ LABEL: while ( ) { &write_dat_file("wr"); &write_scr_file("wr"); } - $rsz = $line[3]; + $rsz = substr($line[3],0,-1);; $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[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; } - if ($line[8] eq "read" && $line[17] eq "write") { + if ($line[10] eq "read" && $line[19] eq "write") { $rdwr = 1; } } else { - if ($line[8] eq "write" && $line[9]) { + if ($line[10] eq "write" && $line[11]) { $writeop = 1; } - if ($line[8] eq "read" && $line[9]) { + if ($line[10] eq "read" && $line[11]) { $readop = 1; } - } 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] eq "failed")) { - goto LABEL2; + if (!($line[$rindex+1] eq "failed")) { + goto LABEL2; } } 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 { - $out{$line[7]}{$line[5] + 1} = $line[$rindex]; + $out{$line[9]}{$line[7] + 1} = $line[$rindex]; } } } if ($writeop) { - $out{$line[7]}{$line[5]} = $line[9]; + $out{$line[9]}{$line[7]} = $line[11]; } 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; -- 1.8.3.1