build-system/gnu: Report the execution time of each phase.

* guix/build/gnu-build-system.scm (gnu-build): Report the success or
  failure of each phase and its execution time.
This commit is contained in:
Ludovic Courtès 2012-12-20 22:31:08 +01:00
parent f5b7894942
commit 4c377e861b
1 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#:use-module (guix build utils) #:use-module (guix build utils)
#:use-module (ice-9 ftw) #:use-module (ice-9 ftw)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:export (%standard-phases #:export (%standard-phases
@ -267,6 +268,11 @@ in order. Return #t if all the PHASES succeeded, #f otherwise."
;; PHASES can pick the keyword arguments it's interested in. ;; PHASES can pick the keyword arguments it's interested in.
(every (match-lambda (every (match-lambda
((name . proc) ((name . proc)
(let ((start (gettimeofday)))
(format #t "starting phase `~a'~%" name) (format #t "starting phase `~a'~%" name)
(apply proc args))) (let ((result (apply proc args))
(end (gettimeofday)))
(format #t "phase `~a' ~:[failed~;succeeded~] after ~a seconds~%"
name result (- (car end) (car start)))
result))))
phases)) phases))