From: nathan Date: Thu, 30 Nov 2006 21:14:29 +0000 (+0000) Subject: b=10958 X-Git-Tag: v1_7_100~393 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=59b1a38a71af73b9192646519862721c1f5b215b b=10958 r=nathan (original patch by jitendra/linsyssoft) sgpdd survey graphing --- diff --git a/lustre-iokit/sgpdd-survey/README.sgpdd-survey b/lustre-iokit/sgpdd-survey/README.sgpdd-survey index 171d7fc..8fb5c97 100644 --- a/lustre-iokit/sgpdd-survey/README.sgpdd-survey +++ b/lustre-iokit/sgpdd-survey/README.sgpdd-survey @@ -31,6 +31,7 @@ number of concurrent stripe files. 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. @@ -43,6 +44,8 @@ The script must be customised according to the particular device under test 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}. @@ -76,5 +79,8 @@ regions) all seem to land on top of each other, it shows the device is 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. diff --git a/lustre-iokit/sgpdd-survey/plot-sgpdd.pl b/lustre-iokit/sgpdd-survey/plot-sgpdd.pl new file mode 100755 index 0000000..16cc994 --- /dev/null +++ b/lustre-iokit/sgpdd-survey/plot-sgpdd.pl @@ -0,0 +1,116 @@ +#!/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 +# [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 \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 ( ) { + 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"; diff --git a/lustre-iokit/sgpdd-survey/sgpdd-survey b/lustre-iokit/sgpdd-survey/sgpdd-survey index b5c1f01..2b6c419 100755 --- a/lustre-iokit/sgpdd-survey/sgpdd-survey +++ b/lustre-iokit/sgpdd-survey/sgpdd-survey @@ -18,7 +18,7 @@ actions="write read" # total size per device (MBytes) # NB bigger than device cache is good -size=8192 +size=${size:-8192} # record size (KBytes) rszlo=1024 @@ -29,6 +29,7 @@ crglo=${crglo:-1} 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} @@ -94,6 +95,15 @@ print_summary () { 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