New command: doom/profile-emacs (powered by esup)
This commit is contained in:
parent
27f99f040c
commit
2b2f6bcf32
2 changed files with 31 additions and 0 deletions
|
@ -89,6 +89,34 @@ the profiling report otherwise."
|
||||||
(profiler-stop))
|
(profiler-stop))
|
||||||
(setq doom--profiler (not doom--profiler)))
|
(setq doom--profiler (not doom--profiler)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom/profile-emacs ()
|
||||||
|
"Profile the startup time of Emacs in the background.
|
||||||
|
If INIT-FILE is non-nil, profile that instead of USER-INIT-FILE."
|
||||||
|
(interactive)
|
||||||
|
(require 'esup)
|
||||||
|
(let ((init-file esup-user-init-file))
|
||||||
|
(message "Starting esup...")
|
||||||
|
(esup-reset)
|
||||||
|
(setq esup-server-process (esup-server-create (esup-select-port)))
|
||||||
|
(setq esup-server-port (process-contact esup-server-process :service))
|
||||||
|
(message "esup process started on port %s" esup-server-port)
|
||||||
|
(let ((process-args `("*esup-child*"
|
||||||
|
"*esup-child*"
|
||||||
|
,esup-emacs-path
|
||||||
|
"-q"
|
||||||
|
"-L" ,esup-load-path
|
||||||
|
"-l" "esup-child"
|
||||||
|
,(format "--eval=(esup-child-run \"%s\" \"%s\" %d)"
|
||||||
|
init-file
|
||||||
|
esup-server-port
|
||||||
|
esup-depth)
|
||||||
|
"--eval=(run-hooks 'after-init-hook 'emacs-startup-hook 'window-setup-hook)")))
|
||||||
|
(when esup-run-as-batch-p
|
||||||
|
(setq process-args (append process-args '("--batch"))))
|
||||||
|
(setq esup-child-process (apply #'start-process process-args)))
|
||||||
|
(set-process-sentinel esup-child-process 'esup-child-process-sentinel)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-info ()
|
(defun doom-info ()
|
||||||
"Returns diagnostic information about the current Emacs session in markdown,
|
"Returns diagnostic information about the current Emacs session in markdown,
|
||||||
|
|
|
@ -34,3 +34,6 @@
|
||||||
;; core-keybinds.el
|
;; core-keybinds.el
|
||||||
(package! which-key)
|
(package! which-key)
|
||||||
(package! hydra)
|
(package! hydra)
|
||||||
|
|
||||||
|
;; other
|
||||||
|
(package! esup)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue