;; 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:
(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
(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))
["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)