guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, string_abstraction2, updated. release_


From: Michael Gran
Subject: [Guile-commits] GNU Guile branch, string_abstraction2, updated. release_1-9-1-152-g5a010bb
Date: Thu, 20 Aug 2009 06:18:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=5a010bbf4e409a628d619874bf3898a914b04ae7

The branch, string_abstraction2 has been updated
       via  5a010bbf4e409a628d619874bf3898a914b04ae7 (commit)
      from  580eca3fbc5021de21274798f0dfd37bafb5c265 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5a010bbf4e409a628d619874bf3898a914b04ae7
Author: Michael Gran <address@hidden>
Date:   Sun Aug 16 21:04:50 2009 -0700

    Add size and title options to benchplot script
    
    * benchmark-suite/benchplot

-----------------------------------------------------------------------

Summary of changes:
 benchmark-suite/benchplot |  164 +++++++++++++++++++++++++++++---------------
 1 files changed, 108 insertions(+), 56 deletions(-)

diff --git a/benchmark-suite/benchplot b/benchmark-suite/benchplot
index bdd00de..db4b745 100755
--- a/benchmark-suite/benchplot
+++ b/benchmark-suite/benchplot
@@ -39,8 +39,18 @@ Convert the output of guile-benchmark to a Gnuplot file.
      -p, --png               Command file will make a PNG
      -t, --title             Title to appear on plot.
                              Default is 'Guile Benchmarks'
-")
-(define LABELS-TO-PLOT '(benchmark user/interp bench/interp gc))
+     -m, --max=VALUE         The maximum y-axis value.
+                             Default is to autoscale
+     -b, --benchmarks=[all,std,min]  Number of benchmarks to plot 
+                             Default is 'std
+")                           
+(define *logfile* "benchmarks.log")
+(define *cmdfile* "bench.gnup")
+(define *datafile* "bench.dat")
+(define *pngfile* #f)
+(define *title* "Guile Benchmarks")
+(define *ymax* #f)
+(define *benchmarks* 'std)
 
 ;; Parse a row from a configuration log to extract the labels for each
 ;; column.
@@ -88,32 +98,32 @@ Convert the output of guile-benchmark to a Gnuplot file.
               (read inport)))))
 
 ;; write the list of lists as a data file
-(define (make-data-file fname list-of-lists)
-  (let ((outport (open-output-file fname)))
+(define (make-data-file list-of-lists)
+  (let ((outport (open-output-file *datafile*)))
     (map
      (lambda (lst)
        (format outport "~{ ~6,5f ~}~%" lst))
-     list-of-lists)
-    fname))
+     list-of-lists))
+  #t)
 
 (define (trunc word)
   (if (< (string-length word) 12)
       word
       (substring word 0 11)))
 
-(define (make-command-file fname names labels data-filename png title)
-  (let ((outport (open-output-file fname)))
+(define (make-command-file names labels)
+  (let ((outport (open-output-file *cmdfile*)))
 
-    (if title
-        (format outport "set title '~a'~%" title))
-
-    (format outport "set ylabel 'Seconds'~%")
-    
-    (if png
+    (if *pngfile*
         (begin
           (format outport "set terminal png~%")
-          (format outport "set output 'tmp.png'~%")))
+          (format outport "set output '~a'~%" *pngfile*)))
 
+    (if *title*
+        (format outport "set title '~a'~%" *title*))
+
+    (format outport "set ylabel 'Seconds'~%")
+    
     ;; Constuct named xtics
     (format outport "set xtics rotate~%")
     (format outport "set xtics (")
@@ -128,37 +138,50 @@ Convert the output of guile-benchmark to a Gnuplot file.
           (format outport "\"~a\" ~d)~%" (trunc name-cur) n)))
 
     ;; Loop over the rows in the data
-    (let loop ((n 1)
-               (label-cur (car labels))
-               (rest (cdr labels)))
-
-      (if (not (null? rest))
-          (begin
-            (if (= n 1)
-                ;; first line
-                (format outport 
-                        "plot '~a' using ~d with linesp title '~a',\\~%"
-                        data-filename n label-cur)
-                ;; middle line
-                (format outport 
-                        "     '~a' using ~d with linesp title '~a',\\~%"
-                        data-filename n label-cur))
-            (loop (+ n 1) (car rest) (cdr rest)))
-          ;; last-line
-          (format outport 
-                  "     '~a' using ~d with linesp title '~a'~%"
-                  data-filename
-                  n
-                  label-cur)))
-
-    (if png
+    (if (= (length labels) 1)
+        (if *ymax*
+            (format outport 
+                    "plot [] [0:~a] '~a' using 1 with linesp title '~a'~%"
+                    *ymax* *datafile* (car labels))
+            (format outport 
+                    "plot [] [0:] '~a' using 1 with linesp title '~a'~%"
+                    *datafile* n (car labels)))
+
+        (let loop ((n 1)
+                   (label-cur (car labels))
+                   (rest (cdr labels)))
+          
+          (if (not (null? rest))
+              (begin
+                (if (= n 1)
+                    ;; first line
+                    (if *ymax*
+                        (format outport 
+                                "plot [] [0:~a] '~a' using ~d with linesp 
title '~a',\\~%"
+                                *ymax* *datafile* n label-cur)
+                        (format outport 
+                                "plot [] [0:] '~a' using ~d with linesp title 
'~a',\\~%"
+                                *datafile* n label-cur))
+                    ;; middle line
+                    (format outport 
+                            "     '~a' using ~d with linesp title '~a',\\~%"
+                            *datafile* n label-cur))
+                (loop (+ n 1) (car rest) (cdr rest)))
+              ;; last-line
+              (format outport 
+                      "     '~a' using ~d with linesp title '~a'~%"
+                      *datafile*
+                      n
+                      label-cur))))
+
+    (if *pngfile*
         (format outport "set output~%")
         (format outport "pause -1 \"Hit return to continue\"~%"))))
 
-(define (make-plot png title logfile cmdfile datafile)
-  (format #t "Reading the logfile ~S~%" logfile)
+(define (make-plot)
+  (format #t "Reading the logfile ~S~%" *logfile*)
 
-  (let* ((inport (open-input-file logfile))
+  (let* ((inport (open-input-file *logfile*))
 
          ;; read in the file
          (data (read-file inport))
@@ -172,13 +195,29 @@ Convert the output of guile-benchmark to a Gnuplot file.
 
          ;; compare the labels with the list of tests to be plotted,
          ;; and create a mask
-         (mask (map 
-                (lambda (c) (member c LABELS-TO-PLOT)) 
-                labels))
+         (mask
+          (cond 
+           ((eqv? *benchmarks* 'std)
+            (map 
+             (lambda (c) (member c '(benchmark user/interp bench/interp gc)))
+             labels))
+           ((eqv? *benchmarks* 'min)
+            (map 
+             (lambda (c) (member c '(bench/interp)))
+             labels))
+           (else
+            #f)))
 
          ;; use the mask to trim down the labels and times
-         (labels-to-plot (mask-labels mask labels))
-         (times-to-plot (mask-times mask times))
+         (labels-to-plot
+          (if (eqv? *benchmarks* 'max)
+              labels
+              (mask-labels mask labels)))
+
+         (times-to-plot
+          (if (eqv? *benchmarks* 'max)
+              times
+              (mask-times mask times)))
          
          ;; get the test names
          ;; The names themselves have the for "CATEGORY: TEST"
@@ -190,16 +229,16 @@ Convert the output of guile-benchmark to a Gnuplot file.
                      data)))
 
     ;; Create the data file 
-    (format #t "Saving data file as ~S~%" datafile)
-    (make-data-file datafile times-to-plot)
+    (format #t "Saving data file as ~S~%" *datafile*)
+    (make-data-file times-to-plot)
 
     ;; Create the gnuplot command file
-    (format #t "Saving gnuplot command file as ~S~%" cmdfile)
-    (make-command-file cmdfile names labels-to-plot datafile png title)
+    (format #t "Saving gnuplot command file as ~S~%" *cmdfile*)
+    (make-command-file names labels-to-plot)
     
-    (format #t "~%Now run 'gnuplot ~a'~%" cmdfile)
-    (if png
-        (format #t "That will generate 'tmp.png'~%"))))
+    (format #t "~%Now run 'gnuplot ~a'~%" *cmdfile*)
+    (if *pngfile*
+        (format #t "That will generate '~a'~%" *pngfile*))))
         
 
 
@@ -207,7 +246,9 @@ Convert the output of guile-benchmark to a Gnuplot file.
   (let* ((option-spec '((input (single-char #\i) (value #t))
                         (output (single-char #\o) (value #t))
                         (datafile (single-char #\d) (value #t))
-                        (png (single-char #\p) (value #f))
+                        (max (single-char #\m) (value #t))
+                        (png (single-char #\p) (value #t))
+                        (benchmarks (single-char #\b) (value #t))
                         (title (single-char #\t) (value #t))
                         (version (single-char #\v) (value #f))
                         (help    (single-char #\h) (value #f))))
@@ -217,6 +258,8 @@ Convert the output of guile-benchmark to a Gnuplot file.
          (datafile (option-ref options 'datafile "bench.dat"))
          (png (option-ref options 'png #f))
          (title (option-ref options 'title "Guile Benchmarks"))
+         (ymax (option-ref options 'max #f))
+         (benchmarks (option-ref options 'benchmarks #f))
          (help-wanted (option-ref options 'help #f))
          (version-wanted (option-ref options 'version #f))
          (logfile #f))
@@ -230,7 +273,16 @@ Convert the output of guile-benchmark to a Gnuplot file.
      ((not (file-exists? infile))
       (error "file not found: ~s" infile))
      (else
-      (make-plot png title infile outfile datafile)))))
+      (set! *logfile* infile)
+      (set! *cmdfile* outfile)
+      (set! *datafile* datafile)
+      (set! *pngfile* png)
+      (set! *title* title)
+      (set! *ymax* ymax)
+      (if benchmarks
+          (set! *benchmarks* (string->symbol benchmarks)))
+      (write *benchmarks*)
+      (make-plot)))))
 
 (main (command-line))
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]