22 Profiling tools
Simple profiling tools.
| |||||
name : symbol? |
Structure used to record a running total time. Only one timer can be running at a time per thread. The accumulated time associated with a timer can be retrieved using timer-value and printed by printing the timer.
timer : timer? |
fn : procedure? |
arg : any |
Applies fn to args and returns the result. Measures the time taken to apply fn and adds it to the running total in timer. Timers are only updated when control passes into or out of a profile form.
Examples: |
> (define t1 (make-timer 't1)) |
499999500000 |
> t1 |
#<timer:t1 0m 0.438s> |
Syntactic shorthand for:
(profile timer (lambda () expr ))
(timer-value timer) → number? |
timer : timer? |
Returns the current value of timer. Timers are only updated when control passes into or out of a profile form.
(timer-reset! timer) → void? |
timer : timer? |
Resets timer to zero.
Returns the timer that is currently running.
Returns a list of all timers created with make-timer or define-timer, plus a single predefined timer called 'top.
Syntactic shorthand for:
(define id (make-timer 'id))