Function: profiler-start
profiler-start is an autoloaded, interactive and byte-compiled
function defined in profiler.el.gz.
Signature
(profiler-start MODE)
Documentation
Start/restart profilers.
MODE can be one of cpu, mem, or cpu+mem.
If MODE is cpu or cpu+mem, start the time-based profiler,
whereby CPU is sampled periodically using the SIGPROF signal.
If MODE is mem or cpu+mem, start profiler that samples CPU
whenever memory-allocation functions are called -- this is useful
if SIGPROF is not supported, or is unreliable, or is not sampling
at a high enough frequency.
Probably introduced at or before Emacs version 24.3.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/profiler.el.gz
;;; Profiler commands
;;;###autoload
(defun profiler-start (mode)
"Start/restart profilers.
MODE can be one of `cpu', `mem', or `cpu+mem'.
If MODE is `cpu' or `cpu+mem', start the time-based profiler,
whereby CPU is sampled periodically using the SIGPROF signal.
If MODE is `mem' or `cpu+mem', start profiler that samples CPU
whenever memory-allocation functions are called -- this is useful
if SIGPROF is not supported, or is unreliable, or is not sampling
at a high enough frequency."
(interactive
(list (if (not (fboundp 'profiler-cpu-start)) 'mem
(intern (completing-read (format-prompt "Mode" "cpu")
'("cpu" "mem" "cpu+mem")
nil t nil nil "cpu")))))
(cl-ecase mode
(cpu
(profiler-cpu-start profiler-sampling-interval)
(message "CPU profiler started"))
(mem
(profiler-memory-start)
(message "Memory profiler started"))
(cpu+mem
(profiler-cpu-start profiler-sampling-interval)
(profiler-memory-start)
(message "CPU and memory profiler started"))))