# modifications in output format of sgpdd-survey.pl script.
# 2. Gnuplot version 4.0 or above is required.]
-my @GraphTitle;
-sub usage() {
- print "Usage: $0 <log_filename> [--rt=<read title>] [--wt=<write title>]\n";
- print " The $0 parses and plots graph for output of sgpdd-survey.pl using gnuplot,\n";
- print " it generates <log_filename>-<Rsize><rd/wr>.dat and <log_filename>-<Rsize>-<rd/wr>.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 <log_filename>-<Rsize>.scr\n";
+sub usage()
+{
+ print STDERR "Usage: $0 [options] <log_filename>\n";
+ print STDERR " $0 parses and plots graphs from the output of sgpdd-survey.pl\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];
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;
}
$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;
}
close DATAFILE;
}
+
if ( !$ARGV[0] ) {
usage();
}
-$file = $ARGV[0];
$region = 0;
$thread = 0;
$count = 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 ( <PFILE> ) {
chomp;
@line = split( /\s+/ );