The device(s) used must meet one of two tests:
SCSI device:
Must appear in the output of 'sg_map'
+ (make sure the kernel module "sg" is loaded)
Raw device:
Must appear in the output of 'raw -qa'
You may not mix raw and SCSI devices in the test specification.
and where it should keep its working files. Customisation variables are
described clearly at the start of the script.
+e.g.: scsidevs=/dev/sda size=128 crghi=16 thrhi=32 ./sgpdd-survey
+
When the script runs, it creates a number of working files and a pair of
result files. All files start with the prefix given by ${rslt}.
phased by seeks at the given record size.
-The included script, parse.pl will process output files and create .csv files fo spreadsheet import
+The included script "parse.pl" will process output files and create
+.csv files for spreadsheet import
+
+The "plot-sgpdd.pl" script plots the results directly using gnuplot.
--- /dev/null
+#!/usr/bin/perl -w
+# Report generation for plot-sgpdd.pl
+# ===================================
+# The plot-sgpdd.pl script is used to generate csv file and
+# instructions files for gnuplot from the output of sgpdd-survey.pl script.
+#
+# The plot-sgpdd.pl also creates .scr file that contains instructions
+# for gnuplot to plot the graph. After generating .dat and .scr files this
+# script invokes gnuplot to display graph.
+#
+# Syntax:
+# $ plot-sgpdd.pl <log_filename>
+# [Note: 1. This script may need modifications whenever there will be
+# modifications in output format of sgpdd-survey.pl script.
+# 2. Gnuplot version 4.0 or above is required.]
+
+# arg 0 is filename
+sub usages_msg() {
+ print "Usage: $0 <log_filename> \n";
+ print " The $0 parses and plots graph for output of sgpdd-survey.pl using gnuplot,\n";
+ print " it generates .dat and .scr files for results graphing\n";
+ print "e.g.> perl $0 sgpdd-log \n";
+ exit 1;
+}
+
+my @GraphTitle;
+if ( !$ARGV[0] ) {
+ usages_msg();
+}
+$file = $ARGV[0];
+$region = 0;
+$thread = 0;
+$count = 0;
+open ( PFILE, "$file") or die "Can't open results";
+LABEL: while ( <PFILE> ) {
+ chomp;
+ @line = split( /\s+/ );
+ if ($count == 0) {
+ @GraphTitle = @line;
+ $count++;
+ next LABEL;
+ }
+ $rindex = 18;
+ if ($line[9]) {
+ if ($line[10] eq "failed") {
+ $rindex = 12;
+ } else {
+ $out{$line[7]}{$line[5]} = $line[9];
+ }
+ }
+ print "rg$line[5] th$line[7] w$line[9] r$line[$rindex]\n";
+ if ($line[$rindex]) {
+ if (!($line[$rindex+1] eq "failed")) {
+ if ($line[5] <= 1 ) {
+ $out{$line[7]}{$line[5] - 1} = $line[$rindex];
+ } else {
+ $out{$line[7]}{$line[5] + 1} = $line[$rindex];
+ }
+ }
+ }
+ if ( $region < $line[7] ) {
+ $region = $line[7];
+ }
+ if ( $thread < $line[5] ) {
+ $thread = $line[5];
+ }
+ $count++;
+}
+close PFILE;
+
+print "@GraphTitle\n";
+# Open .csv file for writting required columns from log file.
+open ( DATAFILE, "> $file.dat" ) or die "Can't open csv file for writting";
+print DATAFILE "0 ";
+for ($j = 1; $j <= $thread ; $j = $j + $j) {
+ print DATAFILE " write$j read$j";
+}
+for ( $i = 1; $i <= $region; $i = $i + $i ) {
+ print DATAFILE "\n$i";
+ for ($j = 1; $j <= $thread ; $j = $j + $j) {
+ if ( $out{$i}{$j} ) {
+ print DATAFILE " $out{$i}{$j}";
+ } else {
+ print DATAFILE " -";
+ }
+ if ( $j <= 1 && $out{$i}{$j - 1}) {
+ print DATAFILE " $out{$i}{$j - 1}";
+ } elsif ($out{$i}{$j + 1}) {
+ print DATAFILE " $out{$i}{$j + 1}";
+ } else {
+ print DATAFILE " -";
+ }
+ }
+}
+close DATAFILE;
+open ( SCRFILE, "> $file.scr" ) or die "Can't open scr file for writting";
+print SCRFILE "set title \"@GraphTitle\"\n";
+print SCRFILE "set xlabel \"Threads\"\n";
+print SCRFILE "set ylabel \"Speeds(MB/s)\"\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;
+ }
+ printf SCRFILE "$plot \"$file.dat\" using 1:$i axes x%dy1 title \"write$j\" with line\n", $xrange;
+ $plot = "replot";
+ $i++;
+ printf SCRFILE "$plot \"$file.dat\" using 1:$i axes x%dy1 title \"read$j\" with line\n", $xrange;
+ $i++;
+}
+print SCRFILE "pause -1\n";
+close SCRFILE;
+system ("gnuplot $file.scr") == 0 or die "ERROR: while ploting graph.\nMake sure that gnuplot is working properly";
# total size per device (MBytes)
# NB bigger than device cache is good
-size=8192
+size=${size:-8192}
# record size (KBytes)
rszlo=1024
crghi=${crghi:-256}
# threads to share between concurrent regions per device
+# multiple threads per region simulates a deeper request queue
# NB survey skips over #thr < #regions and #thr/#regions > SG_MAX_QUEUE
thrlo=${thrlo:-1}
thrhi=${thrhi:-4096}
echo $minusn "$*"
}
+time_v=`date`
+hostname=`hostname`
+if [ "$rawdevs" ]; then
+ print_summary "$time_v sgpdd-survey on $rawdevs from $hostname"
+fi
+if [ "$scsidevs" ]; then
+ print_summary "$time_v sgpdd-survey on $scsidevs from $hostname"
+fi
+
for ((rsz=$rszlo;rsz<=$rszhi;rsz*=2)); do
for ((crg=$crglo;crg<=$crghi;crg*=2)); do
for ((thr=$thrlo;thr<=$thrhi;thr*=2)); do