X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre-iokit%2Fsgpdd-survey%2Fplot-sgpdd;h=8b5d8b87e7d7c7d17106143f5acfb453b09cbcc5;hb=b52a09e6044e44fcdaded37b7aa92e7ed1732e20;hp=542b1da38fcf2e006e7d549a22fafc6e401729b7;hpb=9053b73b74f9994df320100fdc637bf6fda13e23;p=fs%2Flustre-release.git diff --git a/lustre-iokit/sgpdd-survey/plot-sgpdd b/lustre-iokit/sgpdd-survey/plot-sgpdd index 542b1da..8b5d8b8 100755 --- a/lustre-iokit/sgpdd-survey/plot-sgpdd +++ b/lustre-iokit/sgpdd-survey/plot-sgpdd @@ -2,7 +2,7 @@ # Report generation for plot-sgpdd # ================================ # The plot-sgpdd script is used to generate csv file and -# instructions files for gnuplot from the output of sgpdd-survey.pl script. +# instructions files for gnuplot from the output of sgpdd-survey script. # # The plot-sgpdd also creates .scr file that contains instructions # for gnuplot to plot the graph. After generating .dat and .scr files this @@ -12,23 +12,27 @@ # $ sgpdd-survey > log_filename # $ plot-sgpdd # [Note: 1. This script may need modifications whenever there will be -# modifications in output format of sgpdd-survey.pl script. +# modifications in output format of sgpdd-survey script. # 2. Gnuplot version 4.0 or above is required.] -my @GraphTitle; -sub usage() { - print "Usage: $0 [--rt=] [--wt=]\n"; - print " The $0 parses and plots graph for output of sgpdd-survey.pl using gnuplot,\n"; - print " it generates -.dat and --.scr files\n"; - print " those will be used for graphing the results\n"; - print "e.g. # perl $0 sgpdd-log \"8 devices, chunk = 256\"\n"; - print " # gnuplot -.scr\n"; +sub usage() +{ + print STDERR "Usage: $0 [options] \n"; + print STDERR " $0 parses and plots graphs from the output of sgpdd-survey\n"; + print STDERR " It generates text data files (.dat) and graphs (.png) using gnuplot.\n"; + print STDERR "options:\n"; + print STDERR " --rt: Subtitle for read graphs\n"; + print STDERR " --wt: Subtitle for write graphs\n"; + print STDERR " --y: Y-axis scale\n"; + print STDERR "e.g. # $0 --rt=\"no prefetch\" --wt=\"WB disabled\" --y=500 sgpdd.summary\n"; exit 1; } # check whether gnuplot exists? system ("which gnuplot > /dev/null") == 0 or die "gnuplot does not exist, please install it and try again.\n"; +my @GraphTitle; + #Subroutine to write .scr file that further used by gnuplot to plot the graph. sub write_scr_file() { my $op = $_[0]; @@ -54,14 +58,18 @@ sub write_scr_file() { print SCRFILE "set xlabel \"Threads\"\n"; print SCRFILE "set ylabel \"Speeds(MB/s)\"\n"; print SCRFILE "set logscale x\n"; + print SCRFILE "set grid\n"; + if ($opt_y != 0) { + print SCRFILE "set yrange [ 0:$opt_y ]\n"; + } else { + print SCRFILE "set yrange [ 0: ]\n"; + } + my $plot = "plot"; $i = 2; $xrange = 1; # generate instructions for gnuplot, with adjusting X-axes ranges for ($j = 1; $j <= $thread ; $j = $j + $j) { - if ($j > 15 ) { - $xrange = 2; - } if ($op eq "wr") { printf SCRFILE "$plot \"$file-$rsz-$op.dat\" using 1:$i axes x%dy1 title \"write$j\" with line\n", $xrange; } @@ -71,7 +79,7 @@ sub write_scr_file() { $i++; $plot = "replot"; } - print SCRFILE "set terminal png transparent\n"; + print SCRFILE "set terminal png\n"; print SCRFILE "set output \"$file-$rsz-$op.png\"\n"; print SCRFILE "replot\n"; close SCRFILE; @@ -112,10 +120,10 @@ sub write_dat_file() { } close DATAFILE; } + if ( !$ARGV[0] ) { usage(); } -$file = $ARGV[0]; $region = 0; $thread = 0; $count = 0; @@ -126,13 +134,16 @@ $readop = 0; $rsz = 0; $opt_rdtitle = ""; $opt_wrtitle = ""; +$opt_y = 0; # Command line parameter parsing use Getopt::Long; -GetOptions ('help' => \$opt_help, 'rt=s' => \$opt_rdtitle, 'wt=s' => \$opt_wrtitle) or usage(); +GetOptions ('help' => \$opt_help, 'rt=s' => \$opt_rdtitle, 'wt=s' => \$opt_wrtitle, 'y=i' => \$opt_y) or usage(); if ($opt_help) { usage(); } -open ( PFILE, "$file") or die "Can't open results"; +$file = $ARGV[0]; + +open ( PFILE, "$file") or die "Can't open $file"; LABEL: while ( ) { chomp; @line = split( /\s+/ );