]> code.delx.au - gnu-emacs/blobdiff - lisp/profiler.el
* lisp/profiler.el (profiler-calltree-find): Use function-equal.
[gnu-emacs] / lisp / profiler.el
index 73b751c3fcda6212f1ceaaf9e332f2f0a3b58e9a..93ab10015eaecb5f66495088ce82f8d854436c7f 100644 (file)
@@ -5,18 +5,20 @@
 ;; Author: Tomohiro Matsuyama <tomo@cx4a.org>
 ;; Keywords: lisp
 
-;; This program is free software; you can redistribute it and/or modify
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
 ;; (at your option) any later version.
 
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -58,7 +60,7 @@
 (defun profiler-format-number (number)
   "Format NUMBER in human readable string."
   (if (and (integerp number) (> number 0))
-      (cl-loop with i = (% (1+ (floor (log10 number))) 3)
+      (cl-loop with i = (% (1+ (floor (log number 10))) 3)
               for c in (append (number-to-string number) nil)
               if (= i 0)
               collect ?, into s
@@ -254,10 +256,9 @@ Optional argument MODE means only check for the specified mode (cpu or mem)."
 (defun profiler-calltree-find (tree entry)
   "Return a child tree of ENTRY under TREE."
   (let (result (children (profiler-calltree-children tree)))
-    ;; FIXME: Use `assoc'.
     (while (and children (null result))
       (let ((child (car children)))
-       (when (equal (profiler-calltree-entry child) entry)
+       (when (function-equal (profiler-calltree-entry child) entry)
          (setq result child))
        (setq children (cdr children))))
     result))
@@ -466,6 +467,8 @@ RET: expand or collapse"))
         ["Write Profile..." profiler-report-write-profile :active t
          :help "Write current profile to a file"]
         "--"
+        ["Start Profiler" profiler-start :active (not (profiler-running-p))
+         :help "Start profiling"]
         ["Stop Profiler" profiler-stop :active (profiler-running-p)
          :help "Stop profiling"]
         ["New Report" profiler-report :active (profiler-running-p)