summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-01-10 15:39:16 +0100
committerAndrea Corallo <akrl@sdf.org>2021-01-14 22:07:12 +0100
commit00101a8d4cc5bbf875711753c936be52e6e549b1 (patch)
treeea68687128fe6a940608826cd3ce38e3e92d35fb /lisp/emacs-lisp
parent79b9a262ffab37296a39c2d69cdabae153db10a7 (diff)
downloademacs-00101a8d4cc5bbf875711753c936be52e6e549b1.tar.gz
emacs-00101a8d4cc5bbf875711753c936be52e6e549b1.tar.bz2
emacs-00101a8d4cc5bbf875711753c936be52e6e549b1.zip
* Introduce native compilation time reports
* lisp/emacs-lisp/comp.el (comp-log-time-report): New special variable. (comp--native-compile): Rework to log time reports.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp.el30
1 files changed, 21 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index d5ca3b00049..156b00e6273 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -142,6 +142,9 @@ The reproducer is a file ELNFILENAME_libgccjit_repro.c deposed in
the .eln output directory."
:type 'boolean)
+(defvar comp-log-time-report nil
+ "If non-nil, log a time report for each pass.")
+
(defvar comp-dry-run nil
"If non-nil, run everything but the C back-end.")
@@ -3869,15 +3872,24 @@ load once finished compiling."
:with-late-load with-late-load)))
(comp-log "\n \n" 1)
(condition-case err
- (mapc (lambda (pass)
- (unless (memq pass comp-disabled-passes)
- (comp-log (format "(%s) Running pass %s:\n"
- function-or-file pass)
- 2)
- (setf data (funcall pass data))
- (cl-loop for f in (alist-get pass comp-post-pass-hooks)
- do (funcall f data))))
- comp-passes)
+ (cl-loop
+ with report = nil
+ for t0 = (current-time)
+ for pass in comp-passes
+ unless (memq pass comp-disabled-passes)
+ do
+ (comp-log (format "(%s) Running pass %s:\n"
+ function-or-file pass)
+ 2)
+ (setf data (funcall pass data))
+ (push (cons pass (float-time (time-since t0))) report)
+ (cl-loop for f in (alist-get pass comp-post-pass-hooks)
+ do (funcall f data))
+ finally
+ (when comp-log-time-report
+ (comp-log (format "Done compiling %s" data) 0)
+ (cl-loop for (pass . time) in (reverse report)
+ do (comp-log (format "Pass %s took: %fs." pass time) 0))))
(native-compiler-error
;; Add source input.
(let ((err-val (cdr err)))