emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111568: profiler.el tweaks


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111568: profiler.el tweaks
Date: Sat, 19 Jan 2013 18:39:59 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111568
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2013-01-19 18:39:59 -0800
message:
  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.
modified:
  lisp/ChangeLog
  lisp/profiler.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-19 20:54:56 +0000
+++ b/lisp/ChangeLog    2013-01-20 02:39:59 +0000
@@ -1,3 +1,9 @@
+2013-01-20  Glenn Morris  <address@hidden>
+
+       * profiler.el (profiler-running-p): New function.
+       (profiler-cpu-profile): Use profiler-running-p.
+       (profiler-report-mode-map): Add some more menu entries.
+
 2013-01-19  Glenn Morris  <address@hidden>
 
        * mail/unrmail.el (unrmail): Do not mangle the mbox From line;

=== modified file 'lisp/profiler.el'
--- a/lisp/profiler.el  2013-01-02 16:13:04 +0000
+++ b/lisp/profiler.el  2013-01-20 02:39:59 +0000
@@ -200,11 +200,18 @@
     (goto-char (point-min))
     (read (current-buffer))))
 
+(defun profiler-running-p (&optional mode)
+  "Return non-nil if the profiler is running.
+Optional argument MODE means only check for the specified mode (cpu or mem)."
+  (cond ((eq mode 'cpu) (and (fboundp 'profiler-cpu-running-p)
+                             (profiler-cpu-running-p)))
+        ((eq mode 'mem) (profiler-memory-running-p))
+        (t (or (profiler-running-p 'cpu)
+               (profiler-running-p 'mem)))))
+
 (defun profiler-cpu-profile ()
   "Return CPU profile."
-  (when (and (fboundp 'profiler-cpu-running-p)
-             (fboundp 'profiler-cpu-log)
-             (profiler-cpu-running-p))
+  (when (profiler-running-p 'cpu)
     (profiler-make-profile
      :type 'cpu
      :timestamp (current-time)
@@ -457,7 +464,12 @@
         ["Compare Profile..." profiler-report-compare-profile :active t
          :help "Compare current profile with another"]
         ["Write Profile..." profiler-report-write-profile :active t
-         :help "Write current profile to a file"]))
+         :help "Write current profile to a file"]
+        "--"
+        ["Stop Profiler" profiler-stop :active (profiler-running-p)
+         :help "Stop profiling"]
+        ["New Report" profiler-report :active (profiler-running-p)
+         :help "Make a new report"]))
       map)
   "Keymap for `profiler-report-mode'.")
 


reply via email to

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