From 8cd744d4bd8dd7296200785f4263c7b76179f1fa Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Wed, 12 Dec 2007 23:58:10 -0500 Subject: [PATCH] exported verbose-timer parameter that allows printing more detailed information when "time" or "time-it" are used. --- scheme/ikarus.timer.ss | 18 ++++++++++-------- scheme/last-revision | 2 +- scheme/makefile.ss | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/scheme/ikarus.timer.ss b/scheme/ikarus.timer.ss index 84f54b4..0ad4534 100644 --- a/scheme/ikarus.timer.ss +++ b/scheme/ikarus.timer.ss @@ -15,7 +15,7 @@ (library (ikarus timers) - (export time-it) + (export time-it verbose-timer) (import (except (ikarus) time-it)) (define-struct stats @@ -38,19 +38,21 @@ (define (print-stats message bytes t1 t0) (define (print-time msg msecs gc-msecs) - (printf " ~a ms elapsed ~a time, including ~a ms collecting\n" msecs msg + (fprintf + (console-error-port) + " ~a ms elapsed ~a time, including ~a ms collecting\n" msecs msg gc-msecs)) (define (msecs s1 s0 u1 u0) (+ (* (- s1 s0) 1000) (quotient (- u1 u0) 1000))) (if message - (printf "running stats for ~a:\n" message) - (printf "running stats:\n")) + (fprintf (console-error-port) "running stats for ~a:\n" message) + (fprintf (console-error-port) "running stats:\n")) (let ([collections (fx- (stats-collection-id t1) (stats-collection-id t0))]) (case collections - [(0) (display " no collections\n")] - [(1) (display " 1 collection\n")] - [else (printf " ~a collections\n" collections)])) + [(0) (display " no collections\n" (console-error-port))] + [(1) (display " 1 collection\n" (console-error-port))] + [else (fprintf (console-error-port) " ~a collections\n" collections)])) (print-time "cpu" (+ (msecs (stats-user-secs t1) (stats-user-secs t0) (stats-user-usecs t1) (stats-user-usecs t0)) @@ -76,7 +78,7 @@ (stats-sys-usecs t1) (stats-sys-usecs t0)) (msecs (stats-gc-sys-secs t1) (stats-gc-sys-secs t0) (stats-gc-sys-usecs t1) (stats-gc-sys-usecs t0)))) - (printf " ~a bytes allocated\n" bytes)) + (fprintf (console-error-port) " ~a bytes allocated\n" bytes)) (define time-it (case-lambda diff --git a/scheme/last-revision b/scheme/last-revision index 81c545e..d729899 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1234 +1235 diff --git a/scheme/makefile.ss b/scheme/makefile.ss index 6abc799..b740e66 100755 --- a/scheme/makefile.ss +++ b/scheme/makefile.ss @@ -369,6 +369,7 @@ [expand i] [environment? i] [time-it i] + [verbose-timer i] [current-time i] [time? i] [time-second i]