Added an option to subtract the running time of the empty benchmark to

the tabulator.
This commit is contained in:
Vincent St-Amour 2010-06-15 16:38:37 -04:00
parent a33372eb78
commit 93e5d0e9dc

View File

@ -25,6 +25,7 @@ exec racket -qu "$0" ${1+"$@"}
(define include-links (make-parameter #f)) (define include-links (make-parameter #f))
(define nongc (make-parameter #f)) (define nongc (make-parameter #f))
(define subtract-nothing (make-parameter #f)) (define subtract-nothing (make-parameter #f))
(define subtract-nothing-run (make-parameter #f))
(define generate-graph (make-parameter #f)) (define generate-graph (make-parameter #f))
(define no-compile-time (make-parameter #f)) (define no-compile-time (make-parameter #f))
(define coefficient-of-variation (make-parameter #f)) (define coefficient-of-variation (make-parameter #f))
@ -47,6 +48,8 @@ exec racket -qu "$0" ${1+"$@"}
(full-page-mode #t)] (full-page-mode #t)]
[("--nothing") "subtract compilation time of nothing benchmark" [("--nothing") "subtract compilation time of nothing benchmark"
(subtract-nothing #t)] (subtract-nothing #t)]
[("--nothing-run") "subtract the run time of nothing benchmark"
(subtract-nothing-run #t)]
[("--coefficient-of-variation") "show coefficient of variation" [("--coefficient-of-variation") "show coefficient of variation"
(coefficient-of-variation #t)])) (coefficient-of-variation #t)]))
@ -69,11 +72,12 @@ exec racket -qu "$0" ${1+"$@"}
(define bm-runs (hash-table-map bm-table cons)) (define bm-runs (hash-table-map bm-table cons))
(define (average/coefficient-of-variation sel l) (define (average/coefficient-of-variation sel value-to-subtract l)
(if (andmap sel l) (if (andmap sel l)
(let ((avg (round (/ (apply + (map sel l)) (length l))))) (let* ((l (map (lambda (x) (max (- (sel x) value-to-subtract) 0)) l))
(avg (round (/ (apply + l) (length l)))))
(list avg (list avg
(/ (round (sqrt (/ (apply + (map (lambda (x) (expt (- (sel x) avg) 2)) l)) (/ (round (sqrt (/ (apply + (map (lambda (x) (expt (- x avg) 2)) l))
(length l) (length l)
(if (zero? avg) 1.0 avg)))) ; no division by 0 (if (zero? avg) 1.0 avg)))) ; no division by 0
100))) 100)))
@ -87,10 +91,25 @@ exec racket -qu "$0" ${1+"$@"}
(cons (cons
(car bm-run) (car bm-run)
(map (lambda (runs) (map (lambda (runs)
(let ([nothing-run-times
(if (subtract-nothing-run)
(let ([a (hash-table-get
(hash-table-get bm-table 'nothing #hash())
(car runs)
#f)])
(if a
;; compute cpu, real and gc average time for the nothing benchmark
(let ([nothing-runs (map car a)])
(map (lambda (x) (exact->inexact (/ x (length nothing-runs))))
(foldl (lambda (x y) (map + x y))
'(0 0 0)
nothing-runs)))
'(0 0 0)))
'(0 0 0))])
(list (car runs) (list (car runs)
(list (average/coefficient-of-variation caar (cdr runs)) (list (average/coefficient-of-variation caar (car nothing-run-times) (cdr runs))
(average/coefficient-of-variation cadar (cdr runs)) (average/coefficient-of-variation cadar (cadr nothing-run-times) (cdr runs))
(average/coefficient-of-variation caddar (cdr runs))) (average/coefficient-of-variation caddar (caddr nothing-run-times) (cdr runs)))
(let ([nothing-compile-time (let ([nothing-compile-time
(if (subtract-nothing) (if (subtract-nothing)
(let ([a (hash-table-get (let ([a (hash-table-get
@ -103,9 +122,9 @@ exec racket -qu "$0" ${1+"$@"}
0)]) 0)])
(max (- (or (cadadr runs) 0) (max (- (or (cadadr runs) 0)
nothing-compile-time) nothing-compile-time)
0)))) 0)))))
runss)))) runss))))
(if (subtract-nothing) (if (or (subtract-nothing) (subtract-nothing-run))
(filter (lambda (v) (filter (lambda (v)
(not (eq? (car v) 'nothing))) (not (eq? (car v) 'nothing)))
bm-runs) bm-runs)