[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/06: build-system/gnu: Use monotic time to measure elapsed time.
From: |
Ludovic Courtès |
Subject: |
02/06: build-system/gnu: Use monotic time to measure elapsed time. |
Date: |
Sun, 30 Aug 2015 17:10:07 +0000 |
civodul pushed a commit to branch core-updates
in repository guix.
commit 5c962e93e501039ae2658f3c9d5cfe45d50d6396
Author: Ludovic Courtès <address@hidden>
Date: Sun Aug 30 14:08:44 2015 +0200
build-system/gnu: Use monotic time to measure elapsed time.
* guix/build/gnu-build-system.scm (gnu-build)[elapsed-time]: New
procedure.
Use it, and use (current-time time-monotonic) instead
of (gettimeofday). Show one digit after the comma for the elapsed
time.
---
guix/build/gnu-build-system.scm | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 102207b..0a774e1 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -25,6 +25,7 @@
#:use-module (ice-9 regex)
#:use-module (ice-9 format)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (rnrs io ports)
#:export (%standard-phases
@@ -576,6 +577,11 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
#:rest args)
"Build from SOURCE to OUTPUTS, using INPUTS, and by running all of PHASES
in order. Return #t if all the PHASES succeeded, #f otherwise."
+ (define (elapsed-time end start)
+ (let ((diff (time-difference end start)))
+ (+ (time-second diff)
+ (/ (time-nanosecond diff) 1e9))))
+
(setvbuf (current-output-port) _IOLBF)
(setvbuf (current-error-port) _IOLBF)
@@ -586,12 +592,13 @@ in order. Return #t if all the PHASES succeeded, #f
otherwise."
;; PHASES can pick the keyword arguments it's interested in.
(every (match-lambda
((name . proc)
- (let ((start (gettimeofday)))
+ (let ((start (current-time time-monotonic)))
(format #t "starting phase `~a'~%" name)
(let ((result (apply proc args))
- (end (gettimeofday)))
- (format #t "phase `~a' ~:[failed~;succeeded~] after ~a
seconds~%"
- name result (- (car end) (car start)))
+ (end (current-time time-monotonic)))
+ (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f
seconds~%"
+ name result
+ (elapsed-time end start))
;; Dump the environment variables as a shell script, for handy
debugging.
(system "export > $NIX_BUILD_TOP/environment-variables")
- branch core-updates updated (96c4621 -> 8c578a6), Ludovic Courtès, 2015/08/30
- 01/06: gnu: ncurses: Really install headers to OUT/include., Ludovic Courtès, 2015/08/30
- 02/06: build-system/gnu: Use monotic time to measure elapsed time.,
Ludovic Courtès <=
- 04/06: gnu: glibc: _PATH_BSHELL refers to our static bash., Ludovic Courtès, 2015/08/30
- 03/06: gnu: glibc: Use 'modify-phases'., Ludovic Courtès, 2015/08/30
- 05/06: utils: Add 'strip-store-file-name'., Ludovic Courtès, 2015/08/30
- 06/06: utils: Move 'package-name->name+version' to (guix build utils)., Ludovic Courtès, 2015/08/30