summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Radchenko <yantar92@posteo.net>2023-03-13 15:36:53 +0100
committerIhor Radchenko <yantar92@posteo.net>2023-03-13 15:36:53 +0100
commitfdbb7251b4bbbc2cd398a3e38129ecf19034a26e (patch)
tree59d831caa4fa59b3b9ff2fa620da706ac2e0e2fb
parent048af820a7f08fe59ca84e6e78c8a254613ab3ec (diff)
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'.
-rw-r--r--emacs-gc-stats.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/emacs-gc-stats.el b/emacs-gc-stats.el
index 1c2b091..4e1feaa 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)