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,25 +91,40 @@ exec racket -qu "$0" ${1+"$@"}
(cons (cons
(car bm-run) (car bm-run)
(map (lambda (runs) (map (lambda (runs)
(list (car runs) (let ([nothing-run-times
(list (average/coefficient-of-variation caar (cdr runs)) (if (subtract-nothing-run)
(average/coefficient-of-variation cadar (cdr runs)) (let ([a (hash-table-get
(average/coefficient-of-variation caddar (cdr runs))) (hash-table-get bm-table 'nothing #hash())
(let ([nothing-compile-time (car runs)
(if (subtract-nothing) #f)])
(let ([a (hash-table-get (if a
(hash-table-get bm-table 'nothing #hash()) ;; compute cpu, real and gc average time for the nothing benchmark
(car runs) (let ([nothing-runs (map car a)])
#f)]) (map (lambda (x) (exact->inexact (/ x (length nothing-runs))))
(if a (foldl (lambda (x y) (map + x y))
(cadar a) '(0 0 0)
0)) nothing-runs)))
0)]) '(0 0 0)))
(max (- (or (cadadr runs) 0) '(0 0 0))])
nothing-compile-time) (list (car runs)
0)))) (list (average/coefficient-of-variation caar (car nothing-run-times) (cdr runs))
(average/coefficient-of-variation cadar (cadr nothing-run-times) (cdr runs))
(average/coefficient-of-variation caddar (caddr nothing-run-times) (cdr runs)))
(let ([nothing-compile-time
(if (subtract-nothing)
(let ([a (hash-table-get
(hash-table-get bm-table 'nothing #hash())
(car runs)
#f)])
(if a
(cadar a)
0))
0)])
(max (- (or (cadadr runs) 0)
nothing-compile-time)
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)