Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r881 - trunk/StandAlone
- Date: Thu, 2 Feb 2006 15:56:07 -0700 (MST)
Author: abe
Date: Thu Feb 2 15:56:06 2006
New Revision: 881
Modified:
trunk/StandAlone/manta_scaling_plot.pl
Log:
Updated scaling plot script to output linear plot and labels indicating
percent of linear at each data point.
M manta_scaling_plot.pl
Modified: trunk/StandAlone/manta_scaling_plot.pl
==============================================================================
--- trunk/StandAlone/manta_scaling_plot.pl (original)
+++ trunk/StandAlone/manta_scaling_plot.pl Thu Feb 2 15:56:06 2006
@@ -1,4 +1,12 @@
+
+$series = 1;
+$key = "np";
+$plot_type = "minmaxavg";
+$outfile = "";
+$title = "";
+$use_errorbars = 0;
+
sub usage {
print
@@ -9,11 +17,81 @@
" This means that the input is interleaved.\n" .
" Default 1.\n" .
"-labels <label0> <label1>\n" .
+ "-plottype <string> -- default minmaxavg\n".
+ "-title <string>".
+ "-errorbars -- Display min and max with error bars\n".
" -- Specify a label for each series. (required)\n";
}
-$series = 1;
-$key = "np";
+# Form the plot command.
+sub plot_minmaxavg {
+
+ my @plots, $i;
+ my $plot = "";
+
+
+ # Set the xtics.
+ my @tics;
+ for (my $p=0;$p<(@{$data[0]});++$p) {
+ my $tic = $data[0][$p][0];
+ push(@tics,"\"$tic\" ". $tic );
+ }
+ $plot = $plot . "set xtics (" . join( ", ", @tics ) . ")\n";
+
+ # Set the x range of the plot.
+ my $xmax = ($data[0][($data[0][$p][0])-1][0]+8);
+ $plot = $plot . "set xrange [0:$xmax]\n";
+ $plot = $plot . "set yrange [0:]\n";
+
+ # Begin the plot command.
+ $label = "";
+
+ # Usual min/max/average plot.
+ for ($i=0;$i<$series;++$i) {
+
+ # Determine linear plots for average.
+ my $x0 = $data[$i][0][0];
+ my $y0 = $data[$i][0][3];
+ my $x1 = $data[$i][1][0];
+ my $y1 = $data[$i][1][3];
+
+ my $m = ($y1-$y0) / ($x1-$x0);
+
+
+ # Add labels for percent of linear at each point.
+ for (my $p=0;$p<(@{$data[$i]});++$p) {
+ my $x = $data[$i][$p][0];
+ my $y = $m*($x-$x0)+$y0;
+ my $percent_of_lin =
sprintf("%2.0f",(($data[$i][$p][3]/$y)*100));
+
+ $label = $label . "set label \" $percent_of_lin%\" at
$x,$data[$i][$p][3]\n";
+ }
+
+ # Plot the actual data.
+ $tmp_file = "$out_file.temp$i.txt";
+ push(@plots,
+ #"\"$tmp_file\" using 1:2 title \"Min $labels[$i]\", " .
+ #"\"$tmp_file\" using 1:3 title \"Max $labels[$i]\", " .
+ "\"$tmp_file\" using 1:4 title \"Avg $labels[$i]\" with linesp
lt 2 lw 3, " .
+ "$m*(x-$x0)+$y0 notitle with lines 1"
+ );
+
+ # Check to see if we should use error bars.
+ if ($use_errorbars) {
+ push(@plots,
+ "\"$tmp_file\" using 1:4:2:3 notitle with yerrorbars"
+ );
+ }
+
+
+ }
+
+ $plot = "$plot\n$label\nplot " . join( ", ", @plots ) . "\n";
+ # print "PLOT: $plot\n";
+
+ return $plot;
+}
+
# Parse args
for ($i=0;$i<@ARGV;++$i) {
@@ -35,6 +113,15 @@
elsif ($ARGV[$i] eq "-out") {
$out_file = $ARGV[++$i];
}
+ elsif ($ARGV[$i] eq "-plottype") {
+ $plot_type = $ARGV[++$i];
+ }
+ elsif ($ARGV[$i] eq "-title") {
+ $title = $ARGV[++$i];
+ }
+ elsif ($ARGV[$i] eq "-errorbars") {
+ $use_errorbars = 1;
+ }
}
# Check to see if enough subtitles were provided.
@@ -73,6 +160,10 @@
# print "Temporary file: $tmp_file\n";
}
+if ($title eq "") {
+ # $title = "Processor Scaling: $input_file";
+}
+
$line_number = 0;
while (<INPUT>) {
$line = $_;
@@ -90,9 +181,18 @@
if ($line =~ /^Mean fps: ([0-9\.]*)/) {
$mean = $1;
+
+ my $data_index = $line_number/$series;
+ my $series_index = $line_number%$series;
+
+ # Save data point.
+ $data[$series_index][$data_index] = [$np, $min, $max, $mean];
+
# Output.
- print {$TEMP[$line_number%$series]} "$np $min $max $mean\n";
+ print {$TEMP[$series_index]} "$np $min $max $mean\n";
$line_number ++;
+
+
}
};
@@ -110,31 +210,22 @@
$eps_file = $out_file . ".eps";
$plot_file = $out_file . ".gnuplot";
-print "Output to $png_file, $eps_file and $plot_file\n";
-
+print "Output to $out_file $png_file, $eps_file and $plot_file\n";
-# Form the plot command.
-for ($i=0;$i<$series;++$i) {
- $tmp_file = "$out_file.temp$i.txt";
- push(@plots,
- "\"$tmp_file\" using 1:2 title \"Min $labels[$i]\", " .
- "\"$tmp_file\" using 1:3 title \"Max $labels[$i]\", " .
- "\"$tmp_file\" using 1:4 title \"Avg $labels[$i]\"" );
-}
-$plot = "plot " . join( ", ", @plots ) . "\n";
+$plot = plot_minmaxavg();
# print "Plot command: $plot\n";
-print GNUPLOT "set data style linespoints\n";
-print GNUPLOT "set title \"Processor Scaling: $input_file\"\n";
+# print GNUPLOT "set style data linespoints\n";
+print GNUPLOT "set title \"$title\"\n";
print GNUPLOT "set xlabel \"$key\"\n";
print GNUPLOT "set ylabel \"fps\"\n";
-print GNUPLOT "set term png small color\n";
+print GNUPLOT "set term png small monochrome\n";
print GNUPLOT "set output \"$png_file\"\n";
print GNUPLOT $plot;
-print GNUPLOT "set term postscript eps enhanced color\n";
+print GNUPLOT "set term postscript eps enhanced monochrome\n";
print GNUPLOT "set output \"$eps_file\"\n";
print GNUPLOT $plot;
@@ -144,7 +235,7 @@
# Append to the input file.
if (!open(HTML, $out_mode, $out_file)) {
- print "Cannot open $input_file for appending.\n";
+ print "Cannot open $out_file.\n";
exit(1);
}
@@ -154,6 +245,7 @@
print HTML "<img src=\"$png_file\" /></br>\n";
print HTML "(<a href=\"$eps_file\">eps</a>)\n";
+print HTML "(<a href=\"$plot_file\">gnuplot</a>)\n";
for ($i=0;$i<$series;++$i) {
$tmp_file = "$out_file.temp$i.txt";
- [MANTA] r881 - trunk/StandAlone, abe, 02/02/2006
Archive powered by MHonArc 2.6.16.