Changeset 39740 in project
 Timestamp:
 03/18/21 18:14:39 (8 weeks ago)
 Location:
 release/5/microbenchmark/trunk
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

release/5/microbenchmark/trunk/microbenchmark.scm
r39411 r39740 11 11 (benchmarkrun generatestatistics) 12 12 (benchmarkips generatestatistics) 13 (withexpectedbenchmark generatestatistics chisquare) 13 14 runbenchmarkips) 14 15 … … 21 22 (chicken flonum) 22 23 (only (srfi 1) listtabulate map!) 23 microstats)24 (only microstats generatestatistics chisquare)) 24 25 25 26 (condexpand … … 172 173 ;; 173 174 174 (define (*realtimemicrosecs) 175 (let ((ÎŒs (realtimemicrosecs))) 176 (when (negative? ÎŒs) (warning "cannot retrieve time reliably")) 177 ÎŒs ) ) 175 (condexpand 176 (reliabletime 177 (define *realtimemicrosecs realtimemicrosecs) ) 178 (else 179 (define (*realtimemicrosecs) 180 (let ((ÎŒs (realtimemicrosecs))) 181 (when (negative? ÎŒs) (warning "cannot retrieve time reliably")) 182 ÎŒs ) ) ) ) 178 183 179 184 (definesyntax benchmarkmeasure … … 258 263 ((benchmarkips (?seconds ?warmups ?statset) ?code0 ?code1 ...) 259 264 (let ((observed (benchmarkmeasureips (?seconds ?warmups) ?code0 ?code1 ...))) 260 (generatestatistics observed ?statset 265 (generatestatistics observed ?statset) ) ) 261 266 ;C4 API 262 267 ((benchmarkips ?code) … … 268 273 ;; 269 274 270 #; ;FIXME271 275 (definesyntax withexpectedbenchmark 272 276 (syntaxrules () 273 277 ; 274 ((withexpectedbenchmark ?expected ?code ...) 275 (andlet* ((stats (begin ?code ...))) 276 () ) ) ) ) 278 ((withexpectedbenchmark run ?expected ?code0 ?code1 ...) 279 (withexpectedbenchmark ?expected (begin (benchmarkmeasurerun () ?code0 ?code1 ...))) ) 280 ; 281 ((withexpectedbenchmark ips ?expected ?code0 ?code1 ...) 282 (withexpectedbenchmark ?expected (begin (benchmarkmeasureips () ?code0 ?code1 ...))) ) 283 ; 284 ((withexpectedbenchmark (run ?arg ...) ?expected ?code0 ?code1 ...) 285 (withexpectedbenchmark ?expected (begin (benchmarkmeasurerun (?arg ...) ?code0 ?code1 ...))) ) 286 ; 287 ((withexpectedbenchmark (ips ?arg ...) ?expected ?code0 ?code1 ...) 288 (withexpectedbenchmark ?expected (begin (benchmarkmeasureips (?arg ...) ?code0 ?code1 ...))) ) 289 ;incl chisquare w/ generatestatistics result 4 runs 290 ((withexpectedbenchmark ?expected (begin ?code ...)) 291 (let* ( 292 (expected ?expected) 293 (observed (begin ?code ...)) 294 (stats (generatestatistics observed (currentbenchmarkstatisticsset))) ) 295 `((chisquare . ,(chisquare observed expected)) . ,stats) ) ) ) ) 277 296 278 297 ;; 
release/5/microbenchmark/trunk/tests/microbenchmarktestutils.scm
r39411 r39740 1 1 ;;;; 2 3 ;;;4 2 5 3 ;from mathh.scm … … 11 9 12 10 (define log10 (logwithbase 10)) 13 14 ;;;15 11 16 12 ;; 
release/5/microbenchmark/trunk/tests/microbenchmarktest.scm
r39411 r39740 44 44 (currentbenchmarkiterations 3) ) 45 45 (testgroup "benchmarkrun" 46 (let ( 46 (let* ( 47 (runs 48 (begin 49 (waitmessage) 50 (benchmarkmeasurerun (begin (sleep 2))))) 47 51 (stats 48 (let ( 49 (runs 50 (begin 51 (waitmessage) 52 (benchmarkmeasurerun (begin (sleep 2))))) ) 53 (generatestatistics runs (currentbenchmarkstatisticsset)))) ) 52 (generatestatistics runs (currentbenchmarkstatisticsset))) ) 54 53 #;(gloss stats) 55 54 (bigOstatstests MS/SEC stats '( 56 55 max min 57 56 95th 58 arithmeticmean harmonicmean geometricmean median mode)) ) 57 arithmeticmean harmonicmean geometricmean median mode)) 58 ) 59 59 60 60 (let ((stats (benchmarkrun (1) #t))) 61 61 #;(gloss stats) 62 62 (test "deviation for a single result" 0.0 (statsitem sd stats)) ) 63 ) 64 ) 65 66 (parameterize ((currenttestepsilon 0.001) 67 (currentbenchmarkstatisticsset #t) 68 (currentbenchmarkiterations 3) ) 69 (testgroup "withexpectedbenchmark" 70 (let* ( 71 (runs 72 (begin 73 (waitmessage) 74 (benchmarkmeasurerun (begin (sleep 1))))) 75 (cstats 76 (withexpectedbenchmark run runs (sleep 1))) ) 77 (gloss cstats) ) 63 78 ) 64 79 )
Note: See TracChangeset
for help on using the changeset viewer.