emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/emacs-gc-stats fdbb7251b4 07/24: Record init.el stats


From: ELPA Syncer
Subject: [elpa] externals/emacs-gc-stats fdbb7251b4 07/24: Record init.el stats
Date: Sat, 10 Jun 2023 12:58:44 -0400 (EDT)

branch: externals/emacs-gc-stats
commit fdbb7251b4bbbc2cd398a3e38129ecf19034a26e
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]