Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r853 - trunk/StandAlone


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r853 - trunk/StandAlone
  • Date: Thu, 19 Jan 2006 18:36:07 -0700 (MST)

Author: abe
Date: Thu Jan 19 18:36:06 2006
New Revision: 853

Modified:
   trunk/StandAlone/manta_path_plot.pl
   trunk/StandAlone/manta_scaling_plot.pl
Log:


Added command to save gnuplot script.
M    StandAlone/manta_path_plot.pl

Added ability to plot multiple series of interleaved results from the input 
file.
Added code to append results to the input file.
M    StandAlone/manta_scaling_plot.pl


Modified: trunk/StandAlone/manta_path_plot.pl
==============================================================================
--- trunk/StandAlone/manta_path_plot.pl (original)
+++ trunk/StandAlone/manta_path_plot.pl Thu Jan 19 18:36:06 2006
@@ -264,6 +264,8 @@
         @array = split(/\//,$out_file);
         $txt_file_name = $array[@array-1];
 
+        $plot_file = $output_prefix . $line . ".gnuplot";
+
         # Set the line subtitle.
         if ($subtitle eq "") {
             $subtitle = "$input_file:$line";
@@ -281,6 +283,7 @@
         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";
+        print GNUPLOT "save '$plot_file'\n";
         
         close(GNUPLOT);
 
@@ -341,7 +344,7 @@
 @array = split(/\//,$png_file);
 $png_file_name = $array[@array-1];
 
-$eps_file = $output_prefix . $line . ".eps";
+$eps_file = $output_prefix . $line . "-all.eps";
 
 @array = split(/\//,$eps_file);
 $eps_file_name = $array[@array-1];
@@ -349,6 +352,8 @@
 @array = split(/\//,$out_file);
 $txt_file_name = $array[@array-1];
 
+$plot_file = $output_prefix . $line . "-all.gnuplot";
+
 $plot = "plot ";
 for ($i=0; $i<@out_array; ++$i) {
 
@@ -375,6 +380,8 @@
 print GNUPLOT "set output \"$eps_file\"\n";
 print GNUPLOT $plot;    
 
+print GNUPLOT "save '$plot_file'\n";
+
 close(GNUPLOT);
 
 # Output to html file.
@@ -384,6 +391,7 @@
 if ($keep) {
     print HTML "(<a href=\"$txt_file_name\">txt</a>)";
 }
+print HTML "(<a href=\"$plot_file\">gnuplot</a>)";
 
 print HTML "<hr width=100%><p>\n";
 

Modified: trunk/StandAlone/manta_scaling_plot.pl
==============================================================================
--- trunk/StandAlone/manta_scaling_plot.pl      (original)
+++ trunk/StandAlone/manta_scaling_plot.pl      Thu Jan 19 18:36:06 2006
@@ -1,13 +1,37 @@
 
+$series = 1;
+
 # Parse args
 for ($i=0;$i<@ARGV;++$i) {
     if ($ARGV[$i] eq "-file") {
         $input_file = $ARGV[++$i];
     }
+    if ($ARGV[$i] eq "-series") {
+        $series = $ARGV[++$i];
+    }
+    if ($ARGV[$i] eq "-labels") {
+        ++$i;
+        while (($i < @ARGV) && !($ARGV[$i] =~ /^-/)) {
+            push(@labels,$ARGV[$i++]);
+        }
+    }
+}
+
+# Check to see if enough subtitles were provided.
+if (@labels < $series) {
+    print "Must provide a label for each series.\n";
+    exit(1);
 }
 
 if ($input_file eq "") {
-    print "Usage: make_scaling_plot.pl -file <infile.html>\n";
+    print 
+        "Usage: make_scaling_plot.pl -file <infile.html>\n" .
+        "-file <infile.html>  -- Input file\n" .
+        "-series <n>      -- Independent series inteleaved by n lines.\n" .
+        "                    This means that the input is interleaved.\n" .
+        "                    Default 1.\n" .
+        "-label <label0> <label1>\n" .
+        "                 -- Specify a label for each series. (required)\n";
     exit(1);
 }
 
@@ -19,13 +43,17 @@
     exit(1);
 }
 
-# Open a temp file.
-$tmp_file = "make_scaling_plot.temp.txt";
-if (!open(TEMP,">",$tmp_file)) {
-    print "Cannot open $tmp_file\n";
-    exit(1);
+# Open a temp files.
+for ($i=0;$i<$series;++$i) {
+    $tmp_file = "$out_file.temp$i.txt";
+    if (!open($TEMP[$i],">",$tmp_file)) {
+        print "Cannot open $tmp_file\n";
+        exit(1);
+    }
+    # print "Temporary file: $tmp_file\n";
 }
 
+$line_number = 0;
 while (<INPUT>) {
     $line = $_;
     
@@ -41,42 +69,77 @@
     }
     if ($line =~ /^Mean  fps: ([0-9\.]*)/) {
         $mean = $1;
-        print TEMP "$np $min $max $mean\n";
+
+        # Output.
+        print {$TEMP[$line_number%$series]} "$np $min $max $mean\n";
+        $line_number ++;
     }
 };
 
 close (TEMP);
+close (INPUT);
 
 # Plot in gnuplot.
+
 if (!open(GNUPLOT, "|-", "gnuplot")) {
     print "Could not open gnuplot\n";
     exit(1);
 }
 
-$png_file = $out_file . ".png";
-$eps_file = $out_file . ".eps";
+$png_file  = $out_file . ".png";
+$eps_file  = $out_file . ".eps";
+$plot_file = $out_file . ".gnuplot";
+
+print "Output to $png_file, $eps_file and $plot_file\n";
 
-print "Output to $png_file and $eps_file\n";
 
-$plot = "plot \"$tmp_file\" using 1:2 title \"Min\", " .
-             "\"$tmp_file\" using 1:3 title \"Max\", " .
-             "\"$tmp_file\" using 1:4 title \"Avg\"\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";
+
+# print "Plot command: $plot\n";
 
 print GNUPLOT "set data style linespoints\n";
 print GNUPLOT "set title  \"Processor Scaling: $input_file\"\n";
 print GNUPLOT "set xlabel \"np\"\n";
 print GNUPLOT "set ylabel \"fps\"\n";
 
- print GNUPLOT "set term png small color\n";
- print GNUPLOT "set output \"$png_file\"\n";
- print GNUPLOT $plot;
+print GNUPLOT "set term png small color\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;
 
+print GNUPLOT "save '$plot_file'\n";
+
 close (GNUPLOT);
 
-# Remove the tmp file.
+# Append to the input file.
+if (!open(HTML, ">>", $input_file)) {
+    print "Cannot open $input_file for appending.\n";
+    exit(1);
+}
+
+print HTML "<h2>Scaling Plot</h2>\n";
+
+print HTML "Generated using:<br><font face=\"courier\" 
size=-1>manta_scaling_plot.pl " . join(" ",@ARGV) . "</font><p>\n";
+
+print HTML "<img src=\"$png_file\" /></br>\n";
+print HTML "(<a href=\"$eps_file\">eps</a>)\n";
+
+for ($i=0;$i<$series;++$i) {
+    $tmp_file = "$out_file.temp$i.txt";
+    print HTML "(<a href=\"$tmp_file\">txt series $i</a>)\n";
+}
 
+print HTML "<hr width=100%>\n";
 
+close HTML;




  • [MANTA] r853 - trunk/StandAlone, abe, 01/19/2006

Archive powered by MHonArc 2.6.16.

Top of page