mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
time: Support expressions that return any number of values.
* module/ice-9/time.scm (time-proc): Call PROC with 'call-with-values'; return all its values.
This commit is contained in:
parent
53c3d27bfc
commit
24f45332b0
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@
|
||||||
(define (time-proc proc)
|
(define (time-proc proc)
|
||||||
(let* ((gc-start (gc-run-time))
|
(let* ((gc-start (gc-run-time))
|
||||||
(tms-start (times))
|
(tms-start (times))
|
||||||
(result (proc))
|
(results (call-with-values proc list))
|
||||||
(tms-end (times))
|
(tms-end (times))
|
||||||
(gc-end (gc-run-time)))
|
(gc-end (gc-run-time)))
|
||||||
;; FIXME: We would probably like format ~f to accept rationals, but
|
;; FIXME: We would probably like format ~f to accept rationals, but
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
(get tms:cutime tms-start tms-end)
|
(get tms:cutime tms-start tms-end)
|
||||||
(get tms:cstime tms-start tms-end)
|
(get tms:cstime tms-start tms-end)
|
||||||
(get identity gc-start gc-end))
|
(get identity gc-start gc-end))
|
||||||
result))
|
(apply values results)))
|
||||||
|
|
||||||
(define-syntax-rule (time exp)
|
(define-syntax-rule (time exp)
|
||||||
(time-proc (lambda () exp)))
|
(time-proc (lambda () exp)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue