Improve TR timing logging

original commit: 9c4fcd46231f49d94efaacb77c144a92385ba371
This commit is contained in:
Asumu Takikawa 2013-06-20 13:53:46 -04:00
parent cf3593cea0
commit eb8a1f797e

View File

@ -5,6 +5,8 @@
;; some macros to do some timing, only when `timing?' is #t
(define-for-syntax timing? #f)
(define-logger tr-timing)
(define last-time #f) (define initial-time #f)
(define (set!-initial-time t) (set! initial-time t))
(define (set!-last-time t) (set! last-time t))
@ -23,7 +25,9 @@
(error 'start-timing "Timing already started"))
(set!-last-time (current-process-milliseconds))
(set!-initial-time last-time)
(log-debug (format "TR Timing: ~a at ~a" (pad "Starting" 32 #\space) initial-time)))])
(log-tr-timing-debug
(format "~a at ~a"
(pad "Starting" 32 #\space) initial-time)))])
(syntax-rules ()
[(_ msg)
(begin
@ -34,5 +38,7 @@
[diff (- t old)]
[new-msg (pad msg 32 #\space)])
(set!-last-time t)
(log-debug (format "TR Timing: ~a at ~a\tlast step: ~a\ttotal: ~a" new-msg t diff (- t initial-time)))))]))
(log-tr-timing-debug
(format "~a at ~a\tlast step: ~a\ttotal: ~a"
new-msg t diff (- t initial-time)))))]))
(values (lambda _ #'(void)) (lambda _ #'(void)))))