add -o for auto.ss

svn: r4184
This commit is contained in:
Matthew Flatt 2006-08-29 07:43:53 +00:00
parent 9c553c40d9
commit fb156c87fb
2 changed files with 20 additions and 3 deletions

View File

@ -22,7 +22,9 @@ Naming no implementation/benchmark causes a standard of them to be run
implementation/benchmak starts with "no-", the default set is used
minus the "no-"-specified implementation/benchmark.
The output is series of lines of the form
The output is a comment line
; <date and time>
and then a series of lines of the form
[<impl> <benchmark> (<cpu-msec> <real-msec> <gc-msec>) <compile-msec>]
where #f means that the information is unavailable, or that the
benchmark wasn't run due to an implementation limitation. The

View File

@ -9,6 +9,7 @@ exec mzscheme -qu "$0" ${1+"$@"}
(lib "list.ss")
(lib "compile.ss")
(lib "inflate.ss")
(lib "date.ss")
(lib "file.ss" "dynext"))
;; Implementaton-specific control functions ------------------------------
@ -233,7 +234,7 @@ exec mzscheme -qu "$0" ${1+"$@"}
i))
impls)])
(if (memq bm (impl-skips i))
(printf "[~a ~a ~s #f]\n" impl bm '(#f #f #f))
(rprintf "[~a ~a ~s #f]\n" impl bm '(#f #f #f))
(let ([start (current-inexact-milliseconds)])
((impl-make i) bm)
(let ([end (current-inexact-milliseconds)])
@ -244,7 +245,7 @@ exec mzscheme -qu "$0" ${1+"$@"}
[current-error-port out])
((impl-run i) bm))
(error 'auto "~a\nrun failed ~a" (get-output-bytes out) bm))
(printf "[~a ~a ~s ~a]\n"
(rprintf "[~a ~a ~s ~a]\n"
impl
bm
((impl-extract-result i) bm (get-output-bytes out))
@ -253,6 +254,14 @@ exec mzscheme -qu "$0" ${1+"$@"}
((impl-clean-up i) bm)))
(flush-output)))
(define (rprintf . args)
(apply printf args)
(when (current-output-file)
(with-output-to-file (current-output-file)
(lambda ()
(apply printf args))
'append)))
(define no-implementations (map (lambda (s)
(cons (string->symbol (format "no-~a" s))
s))
@ -269,6 +278,8 @@ exec mzscheme -qu "$0" ${1+"$@"}
(define default-implementations (remq* obsolte-impls
(map impl-name impls)))
(define current-output-file (make-parameter #f))
;; Extract command-line arguments --------------------
(define args
@ -288,6 +299,8 @@ exec mzscheme -qu "$0" ${1+"$@"}
(for-each (lambda (bm)
(printf " ~a\n" bm))
benchmarks)]
[("-o" "--out") filename "append output to <filename>"
(current-output-file filename)]
[("-n" "--iters") n "set number of run iterations"
(let ([v (string->number n)])
(unless (and (number? v)
@ -340,6 +353,8 @@ exec mzscheme -qu "$0" ${1+"$@"}
;; Run benchmarks -------------------------------
(rprintf "; ~a\n" (date->string (seconds->date (current-seconds)) #t))
(map (lambda (impl)
(map (lambda (bm)
(run-benchmark impl bm))