Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r612 - branches/itanium2/StandAlone
- Date: Mon, 10 Oct 2005 14:02:23 -0600 (MDT)
Author: abe
Date: Mon Oct 10 14:02:22 2005
New Revision: 612
Modified:
branches/itanium2/StandAlone/manta_path_plot.pl
Log:
Bigger and better benchmark script. It now makes eps files so you can zoom in.
Scaling and resolution tests this afternoon....
M StandAlone/manta_path_plot.pl
Modified: branches/itanium2/StandAlone/manta_path_plot.pl
==============================================================================
--- branches/itanium2/StandAlone/manta_path_plot.pl (original)
+++ branches/itanium2/StandAlone/manta_path_plot.pl Mon Oct 10 14:02:22
2005
@@ -18,6 +18,18 @@
$path_last = 0;
$path_warmup = 10;
$title = "Manta Camera Path Benchmark";
+$plot_x = 1;
+$plot_y = 5;
+$plot_columns = 5;
+$keep = 1;
+
+$start_time = time();
+
+@plot_label = ( "Frame number",
+ "Transaction number",
+ "Elapse Frame",
+ "Elapse Seconds",
+ "Average fps" );
for ($i=0;$i<@ARGV;++$i) {
if ($ARGV[$i] eq "-file") {
@@ -48,6 +60,19 @@
elsif ($ARGV[$i] eq "-title") {
$title = $ARGV[++$i];
}
+ elsif ($ARGV[$i] eq "-plot") {
+ $plot_x = $ARGV[++$i];
+ $plot_y = $ARGV[++$i];
+ }
+ elsif ($ARGV[$i] eq "-keep") {
+ $keep = 1;
+ }
+ elsif ($ARGV[$i] eq "-nokeep") {
+ $keep = 0;
+ }
+ elsif ($ARGV[$i] eq "-columns") {
+ $plot_columns = $ARGV[++$i];
+ }
}
# Check to see if any defaults should be used.
@@ -62,7 +87,13 @@
print "-interval <m> <n>\n";
print "-warmup <n>\n";
print "-title <title>\n";
-
+ print "-plot <x> <y> (default column 1 and 5)\n";
+ print "-columns <n> (number of columns in manta output, default 5)\n";
+ print " Column info is passed to gnuplot, first column is 1
not 0.\n";
+ print "-[no]keep (keep temporary files, default on)\n";
+ print "\n";
+ print "Each line of the command file is either a manta command or \n";
+ print "plot: [above args] to change args between runs\n";
exit(1);
}
@@ -85,12 +116,13 @@
# Read in manta commands.
$line = 0;
+$subtitle = 0;
while (<INPUT>) {
$input_line = $_;
- # Check for a plot command.
+ # Check for a plot arg change.
if (/^plot:(.*)/) {
@plot_args = split(/ /,$1);
@@ -115,6 +147,19 @@
elsif ($plot_args[$i] eq "-warmup") {
$path_warmup = $plot_args[++$i];
}
+ elsif ($plot_args[$i] eq "-plot") {
+ $plot_x = $plot_args[++$i];
+ $plot_y = $plot_args[++$i];
+ }
+ elsif ($plot_args[$i] eq "-keep") {
+ $keep = 1;
+ }
+ elsif ($plot_args[$i] eq "-nokeep") {
+ $keep = 0;
+ }
+ elsif ($plot_args[$i] eq "-subtitle") {
+ $subtitle = $plot_args[++$i];
+ }
}
}
@@ -141,7 +186,7 @@
$total_fps = 0;
$total_samples = 0;
- $out_file = $output_prefix . $line . ".temp";
+ $out_file = $output_prefix . $line . ".temp.txt";
chomp($input_line);
$command = $input_line . $path_command; # . ">& /dev/null";
@@ -162,22 +207,35 @@
# Wait for input
while (<MANTA>) {
- chomp;
- @column = split(/ /);
+
+ # Skip the first sample.
+ if ($total_samples > 0) {
- # print ("Frame: $column[0] fps: $column[4]\n");
- print TEMP $column[0] . " " . $column[4] . "\n";
+ chomp;
+ @column = split(/ /);
- # Keep track of min and max.
- if ($column[4] < $min_fps) {
- $min_fps = $column[4];
- }
- if ($column[4] > $max_fps) {
- $max_fps = $column[4];
- }
+ if (@column == $plot_columns) {
+
+ # print ("Frame: $column[0] fps: $column[4]\n");
+ print TEMP join(" ", @column) . "\n";
+
+ # Keep track of min and max.
+ if ($column[$plot_y-1] < $min_fps) {
+ $min_fps = $column[$plot_y-1];
+ }
+ if ($column[$plot_y-1] > $max_fps) {
+ $max_fps = $column[$plot_y-1];
+ }
- # Keep track of average.
- $total_fps = $total_fps + $column[4];
+ # Keep track of average.
+ $total_fps = $total_fps + $column[$plot_y-1];
+ }
+ else {
+ $actual = @columns;
+ print "Manta output line $line contained $actual columns
$plot_columns expected.\n";
+ --$total_samples;
+ }
+ }
$total_samples++;
}
@@ -192,29 +250,74 @@
}
$png_file = $output_prefix . $line . ".png";
+
+ @array = split(/\//,$png_file);
+ $png_file_name = $array[@array-1];
+
+ $eps_file = $output_prefix . $line . ".eps";
+
+ @array = split(/\//,$eps_file);
+ $eps_file_name = $array[@array-1];
+ @array = split(/\//,$out_file);
+ $txt_file_name = $array[@array-1];
+
+ # Set the line subtitle.
+ if ($subtitle eq "") {
+ $subtitle = "$input_file:$line";
+ }
+
print GNUPLOT "set data style linespoints\n";
- print GNUPLOT "set term png small color\n";
- print GNUPLOT "set xlabel \"Frame Number\"\n";
- print GNUPLOT "set ylabel \"fps\"\n";
+ print GNUPLOT "set xlabel \"" . $plot_label[$plot_x-1] . "\"\n";
+ print GNUPLOT "set ylabel \"" . $plot_label[$plot_y-1] . "\"\n";
print GNUPLOT "set title \"$input_file command $line\"\n";
+
+ print GNUPLOT "set term png small color\n";
print GNUPLOT "set output \"$png_file\"\n";
- print GNUPLOT "plot \"$out_file\" using 1:2 title \"fps\"\n";
+ print GNUPLOT "plot \"$out_file\" using $plot_x:$plot_y title
\"$subtitle\"\n";
+
+ print GNUPLOT "set term postscript eps enhanced color\n";
+ print GNUPLOT "set output \"$eps_file\"\n";
+ print GNUPLOT "plot \"$out_file\" using $plot_x:$plot_y title
\"$subtitle\"\n";
close(GNUPLOT);
# Output to html file.
- print HTML "<h2>\"$input_file\" command line $line</h2>\n";
+ print HTML "<h2>$subtitle</h2>\n";
print HTML "<font face=\"courier\" size=-1>$command</font><br>\n";
- print HTML "<img src=\"$png_file\" /><br><pre>\n";
- print HTML "Min fps: $min_fps\n";
- print HTML "Max fps: $max_fps\n";
- print HTML "Median fps: " . (($min_fps+$max_fps)/2) . "\n";
- print HTML "Mean fps: " . ($total_fps / $total_samples) .
"</pre>\n";
+
+ if ($total_samples > 0) {
+ print HTML "<img src=\"$png_file_name\" /><br>\n";
+
+ print HTML "<br><pre>\n";
+ print HTML "Min fps: $min_fps\n";
+ print HTML "Max fps: $max_fps\n";
+ print HTML "Median fps: " . (($min_fps+$max_fps)/2) . "\n";
+
+ # Subtract one from total samples since we skipped the first one.
+ print HTML "Mean fps: " . ($total_fps / ($total_samples-1)) .
"</pre><br>\n";
+
+ print HTML "(<a href=\"$eps_file_name\">eps</a>)";
+ if ($keep) {
+ print HTML "(<a href=\"$txt_file_name\">txt</a>)";
+ }
+
+
+ }
+ else {
+ print HTML "Error: No samples.<p>\n";
+ }
print HTML "<hr width=100%><p>\n";
+ push(@subtitle_array,$subtitle);
push(@out_array,$out_file);
+ push(@plot_x_array,$plot_x);
+ push(@plot_y_array,$plot_y);
+
+ # Clear the subtitle.
+ $subtitle = "";
+
++$line;
}
@@ -233,12 +336,23 @@
$png_file = $output_prefix . "-all.png";
+@array = split(/\//,$png_file);
+$png_file_name = $array[@array-1];
+
+$eps_file = $output_prefix . $line . ".eps";
+
+@array = split(/\//,$eps_file);
+$eps_file_name = $array[@array-1];
+
+@array = split(/\//,$out_file);
+$txt_file_name = $array[@array-1];
+
$plot = "plot ";
for ($i=0; $i<@out_array; ++$i) {
- print HTML "Line $i: $command_array[$i]\n";
+ print HTML "subtitle_array[$i]: $command_array[$i]\n";
- $plot = $plot . "\"$out_array[$i]\" using 1:2 title \"Line: $i\" ";
+ $plot = $plot . "\"$out_array[$i]\" using
$plot_x_array[$i]:$plot_y_array[$i] title \"$subtitle_array[$i]\" ";
if ($i < (@out_array)-1) {
$plot = $plot . ", ";
}
@@ -249,30 +363,42 @@
print GNUPLOT "set data style linespoints\n";
print GNUPLOT "set term png small color\n";
-print GNUPLOT "set xlabel \"Frame Number\"\n";
-print GNUPLOT "set ylabel \"fps\"\n";
-print GNUPLOT "set title \"$input_file Summary\"\n";
+print GNUPLOT "set xlabel \"" . $plot_label[$plot_x-1] . "\"\n";
+print GNUPLOT "set ylabel \"" . $plot_label[$plot_y-1] . "\"\n";
+print GNUPLOT "set title \"$input_file: $title Summary\"\n";
print GNUPLOT "set output \"$png_file\"\n";
print GNUPLOT $plot;
-
+
+print GNUPLOT "set term postscript eps enhanced color\n";
+print GNUPLOT "set output \"$eps_file\"\n";
+print GNUPLOT $plot;
+
close(GNUPLOT);
# Output to html file.
-print HTML "<img src=\"$png_file\" /><br><pre>\n";
+print HTML "<img src=\"$png_file_name\" /><br>\n";
+
+print HTML "(<a href=\"$eps_file_name\">eps</a>)";
+if ($keep) {
+ print HTML "(<a href=\"$txt_file_name\">txt</a>)";
+}
+
print HTML "<hr width=100%><p>\n";
close (HTML);
close (INPUT);
-# Delete the temp file.
-for ($i=0; $i<@out_array; ++$i) {
+# Delete the temporary files.
+if (!$keep) {
+ for ($i=0; $i<@out_array; ++$i) {
if (!unlink($out_array[$i])) {
print "Could not delete $out_file\n";
exit(1);
}
+ }
}
-
+print "manta_path_plot.pl Completed successfully in " .
((time()-$start_time)/60) ." seconds.\n\n";
- [MANTA] r612 - branches/itanium2/StandAlone, abe, 10/10/2005
Archive powered by MHonArc 2.6.16.