aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-01-19 18:39:59 -0800
committerGlenn Morris2013-01-19 18:39:59 -0800
commit15df6fa4f12fdb2faf798b88c544b31de83591b2 (patch)
tree73a84cfeedc9712d0e870ee6263020cfcd17dd4e
parentee271528bfa645727f03c2a3e04db73b72a76077 (diff)
downloademacs-15df6fa4f12fdb2faf798b88c544b31de83591b2.tar.gz
emacs-15df6fa4f12fdb2faf798b88c544b31de83591b2.zip
profiler.el tweaks
* profiler.el (profiler-running-p): New function. (profiler-cpu-profile): Use profiler-running-p. (profiler-report-mode-map): Add some more menu entries.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/profiler.el20
2 files changed, 22 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bcab1e746a5..02c79ef1920 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-01-20 Glenn Morris <rgm@gnu.org>
2
3 * profiler.el (profiler-running-p): New function.
4 (profiler-cpu-profile): Use profiler-running-p.
5 (profiler-report-mode-map): Add some more menu entries.
6
12013-01-19 Glenn Morris <rgm@gnu.org> 72013-01-19 Glenn Morris <rgm@gnu.org>
2 8
3 * mail/unrmail.el (unrmail): Do not mangle the mbox From line; 9 * mail/unrmail.el (unrmail): Do not mangle the mbox From line;
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 2a4a9013986..9c73fc6e590 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -200,11 +200,18 @@ function name of a function itself."
200 (goto-char (point-min)) 200 (goto-char (point-min))
201 (read (current-buffer)))) 201 (read (current-buffer))))
202 202
203(defun profiler-running-p (&optional mode)
204 "Return non-nil if the profiler is running.
205Optional argument MODE means only check for the specified mode (cpu or mem)."
206 (cond ((eq mode 'cpu) (and (fboundp 'profiler-cpu-running-p)
207 (profiler-cpu-running-p)))
208 ((eq mode 'mem) (profiler-memory-running-p))
209 (t (or (profiler-running-p 'cpu)
210 (profiler-running-p 'mem)))))
211
203(defun profiler-cpu-profile () 212(defun profiler-cpu-profile ()
204 "Return CPU profile." 213 "Return CPU profile."
205 (when (and (fboundp 'profiler-cpu-running-p) 214 (when (profiler-running-p 'cpu)
206 (fboundp 'profiler-cpu-log)
207 (profiler-cpu-running-p))
208 (profiler-make-profile 215 (profiler-make-profile
209 :type 'cpu 216 :type 'cpu
210 :timestamp (current-time) 217 :timestamp (current-time)
@@ -457,7 +464,12 @@ RET: expand or collapse"))
457 ["Compare Profile..." profiler-report-compare-profile :active t 464 ["Compare Profile..." profiler-report-compare-profile :active t
458 :help "Compare current profile with another"] 465 :help "Compare current profile with another"]
459 ["Write Profile..." profiler-report-write-profile :active t 466 ["Write Profile..." profiler-report-write-profile :active t
460 :help "Write current profile to a file"])) 467 :help "Write current profile to a file"]
468 "--"
469 ["Stop Profiler" profiler-stop :active (profiler-running-p)
470 :help "Stop profiling"]
471 ["New Report" profiler-report :active (profiler-running-p)
472 :help "Make a new report"]))
461 map) 473 map)
462 "Keymap for `profiler-report-mode'.") 474 "Keymap for `profiler-report-mode'.")
463 475