Moved startup profiler settings to init.el and simplified activation.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 02 Jan 2021 23:11:23 +0200
changeset 1688 0bab53c47567
parent 1687 3f69332472cb
child 1689 96846689e388
Moved startup profiler settings to init.el and simplified activation.
.emacs-defs
.emacs-my
.emacs-post
.emacs-pre
init.el
--- a/.emacs-defs	Sat Jan 02 22:42:24 2021 +0200
+++ b/.emacs-defs	Sat Jan 02 23:11:23 2021 +0200
@@ -1,5 +1,8 @@
 ;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78; no-byte-compile: t; -*-
 
+(defvar my-profiler-enabled nil
+  "Switch for enabling startup profiling. Set to `t' in '~/.emacs-pre'.")
+
 (defvar my-lisp-usr-home-dir
   (expand-file-name "~/usr/share/emacs/site-lisp")
   "There is a place for additional lisp packages installed via 'DIST=~/usr make install'.")
--- a/.emacs-my	Sat Jan 02 22:42:24 2021 +0200
+++ b/.emacs-my	Sat Jan 02 23:11:23 2021 +0200
@@ -3873,7 +3873,7 @@
 ; Lazy loading of buffer significantly reduces startup time!
 (setq desktop-restore-eager 1)
 (setq desktop-restore-frames nil)
-(unless (and (boundp 'my-no-desktop-save-mode) my-no-desktop-save-mode)
+(unless my-profiler-enabled
   (desktop-save-mode 1))
 (setq
  desktop-globals-to-save
--- a/.emacs-post	Sat Jan 02 22:42:24 2021 +0200
+++ b/.emacs-post	Sat Jan 02 23:11:23 2021 +0200
@@ -22,9 +22,3 @@
 ;;        '(".*\\.\\([ch]\\|cpp\\|rc\\)" "c:/Program Files/Microsoft SDKs/Windows/v6.1/Include/TAGS")
 ;;        ))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; (message "profiler end")
-
-;; (profiler-report)
-;; (profiler-stop)
-
--- a/.emacs-pre	Sat Jan 02 22:42:24 2021 +0200
+++ b/.emacs-pre	Sat Jan 02 23:11:23 2021 +0200
@@ -5,13 +5,12 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; (message "profiler start")
 
-;; (profiler-start 'cpu)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; To disable activation desktop-save-mode as it ask for file overriding when
-;; two Emacs are loaded making difficult automating like:  time emacs-w32 --kill
-
-;; (setq my-no-desktop-save-mode t)
+;; Set to `t' and run:
+;;   time emacs-w32 --kill
+(setq my-profiler-enabled nil)
+;; Override default only when actually profiling... Default is 1000000 ns.
+(when my-profiler-enabled
+  (setq profiler-sampling-interval 100000))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; (message "libs pre-loading")
--- a/init.el	Sat Jan 02 22:42:24 2021 +0200
+++ b/init.el	Sat Jan 02 23:11:23 2021 +0200
@@ -16,6 +16,9 @@
 (load my-lisp-auth t)
 (load my-lisp-pre)
 
+(when my-profiler-enabled
+  (profiler-start 'cpu))
+
 (my-lisp--load-usr-home)
 
 ;; (setq package-enable-at-startup t)
@@ -26,3 +29,6 @@
 (load my-lisp-dotemacs t)
 (load my-lisp-post t)
 
+(when my-profiler-enabled
+  (profiler-report)
+  (profiler-stop))