branch: externals/emacs-gc-stats commit fdbb7251b4bbbc2cd398a3e38129ecf19034a26e Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
Record init.el stats * emacs-gc-stats.el (emacs-gc-stats--collect-init-end): New function. (emacs-gc-stats-mode): Hook the new stats collector into `after-init-hook'. --- emacs-gc-stats.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs-gc-stats.el b/emacs-gc-stats.el index 1c2b091749..4e1feaac8e 100644 --- a/emacs-gc-stats.el +++ b/emacs-gc-stats.el @@ -114,6 +114,15 @@ Otherwise, collect symbol." emacs-gc-stats--command-vars) emacs-gc-stats--data)) +(defun emacs-gc-stats--collect-init-end () + "Collect init.el stats." + (push + (apply #'emacs-gc-stats--collect + "Init.el stats" + (current-time-string) + emacs-gc-stats--summary-vars) + emacs-gc-stats--data)) + (defun emacs-gc-stats--collect-end () "Collect initial stats." (push @@ -160,8 +169,10 @@ Otherwise, collect symbol." (unless emacs-gc-stats--data (emacs-gc-stats--collect-init)) (add-hook 'post-gc-hook #'emacs-gc-stats--collect-gc) + (add-hook 'after-init-hook #'emacs-gc-stats--collect-init-end) (add-hook 'kill-emacs-hook #'emacs-gc-stats-save-session)) (remove-hook 'post-gc-hook #'emacs-gc-stats--collect-gc) + (remove-hook 'after-init-hook #'emacs-gc-stats--collect-init-end) (remove-hook 'kill-emacs-hook #'emacs-gc-stats-save-session))) (provide 'emacs-gc-stats)