racket/collects/mztake/demos/sprofiler/sprofiler.ss
Guillaume Marceau e82a136fbe added the statistical profiler
svn: r184
2005-05-12 22:32:17 +00:00

22 lines
639 B
Scheme

(require (lib "mztake.ss" "mztake" )
(lib "match.ss")
(lib "more-useful-code.ss" "mztake" "private" ))
(set-main! "picture.ss")
(define (hash-table-increment! h k)
(let ([old (hash-get h k (lambda () 0))])
(hash-put! h k (add1 old))))
(define pings (make-hash 'equal))
((changes where)
. ==> . (match-lambda [(line function context rest ...)
(hash-table-increment! pings (list function context))]
[_ (void)]))
(define clicks (changes (quotient milliseconds 50)))
(set-running-e! (merge-e (clicks . -=> . false)
(clicks . -=> . true)))