summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ice-9/ChangeLog5
-rw-r--r--ice-9/time.scm25
2 files changed, 19 insertions, 11 deletions
diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog
index 634277778..1625cf35b 100644
--- a/ice-9/ChangeLog
+++ b/ice-9/ChangeLog
@@ -1,5 +1,10 @@
2001-03-20 Keisuke Nishida <kxn30@po.cwru.edu>
+ * time.scm (time): Reimplemented as a procedure call.
+ (Thanks to Marius Vollmer)
+
+2001-03-20 Keisuke Nishida <kxn30@po.cwru.edu>
+
* safe-r5rs.scm (list): Export.
2001-03-17 Keisuke Nishida <kxn30@po.cwru.edu>
diff --git a/ice-9/time.scm b/ice-9/time.scm
index 0be666cd5..828b2d5c1 100644
--- a/ice-9/time.scm
+++ b/ice-9/time.scm
@@ -21,20 +21,23 @@
:use-module (ice-9 format)
:export (time))
-(define-macro (time form)
+(define (time-proc proc)
(let* ((gc-start (gc-run-time))
- (tms-start (times))
- (result (eval form (interaction-environment)))
- (tms-end (times))
- (gc-end (gc-run-time)))
+ (tms-start (times))
+ (result (proc))
+ (tms-end (times))
+ (gc-end (gc-run-time)))
(define (get proc start end)
(/ (- (proc end) (proc start)) internal-time-units-per-second))
(display "clock utime stime cutime cstime gctime\n")
(format #t "~5,2F ~5,2F ~5,2F ~6,2F ~6,2F ~6,2F\n"
- (get tms:clock tms-start tms-end)
- (get tms:utime tms-start tms-end)
- (get tms:stime tms-start tms-end)
- (get tms:cutime tms-start tms-end)
- (get tms:cstime tms-start tms-end)
- (get id gc-start gc-end))
+ (get tms:clock tms-start tms-end)
+ (get tms:utime tms-start tms-end)
+ (get tms:stime tms-start tms-end)
+ (get tms:cutime tms-start tms-end)
+ (get tms:cstime tms-start tms-end)
+ (get id gc-start gc-end))
result))
+
+(define-macro (time exp)
+ `(,time-proc (lambda () ,exp)))