aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/elp.el30
1 files changed, 14 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index 4fb4a438b26..1be46ae7e3d 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -1,7 +1,6 @@
1;;; elp.el --- Emacs Lisp Profiler -*- lexical-binding: t -*- 1;;; elp.el --- Emacs Lisp Profiler -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1994-1995, 1997-1998, 2001-2021 Free Software 3;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
4;; Foundation, Inc.
5 4
6;; Author: Barry A. Warsaw 5;; Author: Barry A. Warsaw
7;; Maintainer: emacs-devel@gnu.org 6;; Maintainer: emacs-devel@gnu.org
@@ -30,8 +29,8 @@
30;; hacks those functions so that profiling information is recorded 29;; hacks those functions so that profiling information is recorded
31;; whenever they are called. To print out the current results, use 30;; whenever they are called. To print out the current results, use
32;; M-x elp-results. If you want output to go to standard-output 31;; M-x elp-results. If you want output to go to standard-output
33;; instead of a separate buffer, setq elp-use-standard-output to 32;; instead of a separate buffer, set `elp-use-standard-output' to
34;; non-nil. With elp-reset-after-results set to non-nil, profiling 33;; non-nil. With `elp-reset-after-results' set to non-nil, profiling
35;; information will be reset whenever the results are displayed. You 34;; information will be reset whenever the results are displayed. You
36;; can also reset all profiling info at any time with M-x 35;; can also reset all profiling info at any time with M-x
37;; elp-reset-all. 36;; elp-reset-all.
@@ -40,12 +39,12 @@
40;; the package follows the GNU coding standard of a common textual 39;; the package follows the GNU coding standard of a common textual
41;; prefix. Use M-x elp-instrument-package for this. 40;; prefix. Use M-x elp-instrument-package for this.
42;; 41;;
43;; If you want to sort the results, set elp-sort-by-function to some 42;; If you want to sort the results, set `elp-sort-by-function' to some
44;; predicate function. The three most obvious choices are predefined: 43;; predicate function. The three most obvious choices are predefined:
45;; elp-sort-by-call-count, elp-sort-by-average-time, and 44;; `elp-sort-by-call-count', `elp-sort-by-average-time', and
46;; elp-sort-by-total-time. Also, you can prune from the output, all 45;; `elp-sort-by-total-time'. Also, you can prune from the output, all
47;; functions that have been called fewer than a given number of times 46;; functions that have been called fewer than a given number of times
48;; by setting elp-report-limit. 47;; by setting `elp-report-limit'.
49;; 48;;
50;; Elp can instrument byte-compiled functions just as easily as 49;; Elp can instrument byte-compiled functions just as easily as
51;; interpreted functions, but it cannot instrument macros. However, 50;; interpreted functions, but it cannot instrument macros. However,
@@ -95,11 +94,11 @@
95 94
96;; Note that there are plenty of factors that could make the times 95;; Note that there are plenty of factors that could make the times
97;; reported unreliable, including the accuracy and granularity of your 96;; reported unreliable, including the accuracy and granularity of your
98;; system clock, and the overhead spent in lisp calculating and 97;; system clock, and the overhead spent in Lisp calculating and
99;; recording the intervals. I figure the latter is pretty constant, 98;; recording the intervals. I figure the latter is pretty constant,
100;; so while the times may not be entirely accurate, I think they'll 99;; so while the times may not be entirely accurate, I think they'll
101;; give you a good feel for the relative amount of work spent in the 100;; give you a good feel for the relative amount of work spent in the
102;; various lisp routines you are profiling. Note further that times 101;; various Lisp routines you are profiling. Note further that times
103;; are calculated using wall-clock time, so other system load will 102;; are calculated using wall-clock time, so other system load will
104;; affect accuracy too. 103;; affect accuracy too.
105 104
@@ -405,15 +404,15 @@ original definition, use \\[elp-restore-function] or \\[elp-restore-all]."
405(defvar elp-et-len nil) 404(defvar elp-et-len nil)
406 405
407(defun elp-sort-by-call-count (vec1 vec2) 406(defun elp-sort-by-call-count (vec1 vec2)
408 ;; sort by highest call count. See `sort'. 407 "Predicate to sort by highest call count. See `sort'."
409 (>= (aref vec1 0) (aref vec2 0))) 408 (>= (aref vec1 0) (aref vec2 0)))
410 409
411(defun elp-sort-by-total-time (vec1 vec2) 410(defun elp-sort-by-total-time (vec1 vec2)
412 ;; sort by highest total time spent in function. See `sort'. 411 "Predicate to sort by highest total time spent in function. See `sort'."
413 (>= (aref vec1 1) (aref vec2 1))) 412 (>= (aref vec1 1) (aref vec2 1)))
414 413
415(defun elp-sort-by-average-time (vec1 vec2) 414(defun elp-sort-by-average-time (vec1 vec2)
416 ;; sort by highest average time spent in function. See `sort'. 415 "Predicate to sort by highest average time spent in function. See `sort'."
417 (>= (aref vec1 2) (aref vec2 2))) 416 (>= (aref vec1 2) (aref vec2 2)))
418 417
419(defsubst elp-pack-number (number width) 418(defsubst elp-pack-number (number width)
@@ -471,13 +470,13 @@ original definition, use \\[elp-restore-function] or \\[elp-restore-all]."
471 "Keymap used on the function name column." ) 470 "Keymap used on the function name column." )
472 471
473(defun elp-results-jump-to-definition (&optional event) 472(defun elp-results-jump-to-definition (&optional event)
474 "Jump to the definition of the function under the point." 473 "Jump to the definition of the function at point."
475 (interactive (list last-nonmenu-event)) 474 (interactive (list last-nonmenu-event))
476 (if event (posn-set-point (event-end event))) 475 (if event (posn-set-point (event-end event)))
477 (find-function (get-text-property (point) 'elp-symname))) 476 (find-function (get-text-property (point) 'elp-symname)))
478 477
479(defun elp-output-insert-symname (symname) 478(defun elp-output-insert-symname (symname)
480 ;; Insert SYMNAME with text properties. 479 "Insert SYMNAME with text properties."
481 (insert (propertize symname 480 (insert (propertize symname
482 'elp-symname (intern symname) 481 'elp-symname (intern symname)
483 'keymap elp-results-symname-map 482 'keymap elp-results-symname-map
@@ -588,7 +587,6 @@ displayed."
588 "Un-instrument before unloading a function." 587 "Un-instrument before unloading a function."
589 (elp-restore-function (cdr x))) 588 (elp-restore-function (cdr x)))
590 589
591
592(provide 'elp) 590(provide 'elp)
593 591
594;;; elp.el ends here 592;;; elp.el ends here