diff options
author | Christopher Baines <mail@cbaines.net> | 2020-11-06 19:50:12 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-11-06 19:50:12 +0000 |
commit | 98132e41824e1cbf3238581306482006147cbd87 (patch) | |
tree | eb2f81f23a1455151d7f24db962220f5d43b311e /guix-build-coordinator | |
parent | 731bf719eaecbfe523bf448a31670c272002aff2 (diff) | |
download | build-coordinator-98132e41824e1cbf3238581306482006147cbd87.tar build-coordinator-98132e41824e1cbf3238581306482006147cbd87.tar.gz |
Handle multiple values in call-with-time-logging
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/utils.scm | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index b672a9b..6a69c94 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -508,16 +508,18 @@ References: ~a~%" #t))) (define (call-with-time-logging name thunk) - (let* ((start (current-time time-utc)) - (result (thunk)) - (end (current-time time-utc)) - (elapsed (time-difference end start))) - (format (current-output-port) - "~a took ~a seconds~%" - name - (+ (time-second elapsed) - (/ (time-nanosecond elapsed) 1e9))) - result)) + (let ((start (current-time time-utc))) + (call-with-values + thunk + (lambda vals + (let* ((end (current-time time-utc)) + (elapsed (time-difference end start))) + (format (current-output-port) + "~a took ~a seconds~%" + name + (+ (time-second elapsed) + (/ (time-nanosecond elapsed) 1e9))) + (apply values vals)))))) (define-syntax-rule (with-time-logging name exp ...) "Log under NAME the time taken to evaluate EXP." |