time now shows gc portion

This commit is contained in:
Abdulaziz Ghuloum 2007-08-30 13:16:06 -04:00
parent f030e4e11d
commit 2371c5a776
2 changed files with 11 additions and 4 deletions

Binary file not shown.

View File

@ -20,8 +20,9 @@
(foreign-call "ikrt_stats_now" t)) (foreign-call "ikrt_stats_now" t))
(define (print-stats message bytes t1 t0) (define (print-stats message bytes t1 t0)
(define (print-time msg msecs) (define (print-time msg msecs gc-msecs)
(printf " ~a ms elapsed ~a time\n" msecs msg)) (printf " ~a ms elapsed ~a time (~a ms collecting)\n" msecs msg
gc-msecs))
(define (msecs s1 s0 u1 u0) (define (msecs s1 s0 u1 u0)
(+ (* (- s1 s0) 1000) (quotient (- u1 u0) 1000))) (+ (* (- s1 s0) 1000) (quotient (- u1 u0) 1000)))
(if message (if message
@ -37,10 +38,16 @@
(+ (msecs (stats-user-secs t1) (stats-user-secs t0) (+ (msecs (stats-user-secs t1) (stats-user-secs t0)
(stats-user-usecs t1) (stats-user-usecs t0)) (stats-user-usecs t1) (stats-user-usecs t0))
(msecs (stats-sys-secs t1) (stats-sys-secs t0) (msecs (stats-sys-secs t1) (stats-sys-secs t0)
(stats-sys-usecs t1) (stats-sys-usecs t0)))) (stats-sys-usecs t1) (stats-sys-usecs t0)))
(+ (msecs (stats-gc-user-secs t1) (stats-gc-user-secs t0)
(stats-gc-user-usecs t1) (stats-gc-user-usecs t0))
(msecs (stats-gc-sys-secs t1) (stats-gc-sys-secs t0)
(stats-gc-sys-usecs t1) (stats-gc-sys-usecs t0))))
(print-time "real" (print-time "real"
(msecs (stats-real-secs t1) (stats-real-secs t0) (msecs (stats-real-secs t1) (stats-real-secs t0)
(stats-real-usecs t1) (stats-real-usecs t0))) (stats-real-usecs t1) (stats-real-usecs t0))
(msecs (stats-gc-real-secs t1) (stats-gc-real-secs t0)
(stats-gc-real-usecs t1) (stats-gc-real-usecs t0)))
(printf " ~a bytes allocated\n" bytes)) (printf " ~a bytes allocated\n" bytes))
(define (print-stats-old message bytes t1 t0) (define (print-stats-old message bytes t1 t0)