Changeset 39401 in project


Ignore:
Timestamp:
11/27/20 19:05:37 (7 weeks ago)
Author:
Kon Lovett
Message:

no export iter, stop double eval in test, timer resolution for test

Location:
release/5/micro-benchmark/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/micro-benchmark/trunk/micro-benchmark.scm

    r39375 r39401  
    1212  (benchmark-run generate-statistics)
    1313  (benchmark-ips generate-statistics)
    14   run-benchmark-ips
    15   *iterations-overhead*)
     14  run-benchmark-ips)
    1615
    1716(import scheme
  • release/5/micro-benchmark/trunk/tests/micro-benchmark-test-utils.scm

    r39393 r39401  
    11;;;;
    2 
    3 ;NOTE (sleep i) seems to actually sleep i-1 seconds on windows
    42
    53;;
     
    86  (syntax-rules ()
    97    ((_ ?O ?expr)
    10      (test-bigO ((let () (import (only (chicken string) ->string)) ->string) ?expr) ?O ?expr) )
     8     (let ((_expr ?expr))
     9      (import (only (chicken string) ->string))
     10      (test-bigO (->string _expr) ?O _expr) ) )
    1111    ((_ ?msg ?O ?expr)
    12      (test-assert ?msg (bigO= ?O ?expr)) ) ) )
     12     (begin
     13      #;(gloss ?expr)
     14      (test-assert ?msg (bigO= ?O ?expr))) ) ) )
    1315
    1416;;
  • release/5/micro-benchmark/trunk/tests/micro-benchmark-test.scm

    r39393 r39401  
    2222;;
    2323
    24 (define (ÎŒs->secs ÎŒs) (/ ÎŒs 1000000.0))
     24;(define-constant RT/SEC 1000000000.0) ;ns
     25(define-constant RT/SEC 1000000.0)    ;ÎŒs
     26
     27(define (rt->secs x) (/ x RT/SEC))
    2528
    2629(import (only micro-stats generate-statistics))
     
    2831(test-begin "micro-benchmark")
    2932
     33;NOTE (sleep i) seems to actually sleep i-1 seconds on windows
     34
     35#;
    3036(test-group "basic"
    3137  (test-assert (glossed *iterations-overhead*))
     
    3541(test-group "benchmark-measure"
    3642  (wait-message)
    37   (test-bigO "benchmark-measure returns runtime" 1000000.0 (benchmark-measure (sleep 2)))
     43  (test-bigO "benchmark-measure returns runtime" RT/SEC (benchmark-measure (sleep 2)))
    3844  (wait-message)
    3945  (parameterize ((current-test-epsilon 0.009))
    40     (test 1.00 (ÎŒs->secs (benchmark-measure (sleep 1))))
     46    (test 1.00 (rt->secs (benchmark-measure (sleep 1))))
    4147  )
    4248)
     
    5561          (generate-statistics runs (current-benchmark-statistics-set)))) )
    5662      #;(gloss stats)
    57       (bigO-stats-tests 1000000.0 stats '(
     63      (bigO-stats-tests RT/SEC stats '(
    5864        max min
    5965        95th
     
    7379    ;simply measure the runtime of the given fragment
    7480    (wait-message)
    75     (test 2.00 (ÎŒs->secs (benchmark-measure (sleep 2))))
     81    (test 2.00 (rt->secs (benchmark-measure (sleep 2))))
    7682
    7783    ;run code 3 times and return results
    7884    (wait-message)
    79     (test 1.00 (ÎŒs->secs (stats-item mean (benchmark-run (sleep 1)))))
     85    (test 1.00 (rt->secs (stats-item mean (benchmark-run (sleep 1)))))
    8086
    8187    ;find out how many iterations we can make per second
Note: See TracChangeset for help on using the changeset viewer.