diff options
| author | Richard M. Stallman | 1994-12-29 00:11:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-12-29 00:11:46 +0000 |
| commit | b96bffd7a0111baac463f8f460229c0c4a8ab577 (patch) | |
| tree | 8b8d20dae615a4305e2469fe4aa6c81fa9c6ced4 | |
| parent | ef2515c0517f8045c26a27c4319aac606bad42fa (diff) | |
| download | emacs-b96bffd7a0111baac463f8f460229c0c4a8ab577.tar.gz emacs-b96bffd7a0111baac463f8f460229c0c4a8ab577.zip | |
Comment changes.
| -rw-r--r-- | lisp/emacs-lisp/elp.el | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el index fc52ed04eae..26cc8bd9b72 100644 --- a/lisp/emacs-lisp/elp.el +++ b/lisp/emacs-lisp/elp.el | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | ;; Author: 1994 Barry A. Warsaw <bwarsaw@cnri.reston.va.us> | 5 | ;; Author: 1994 Barry A. Warsaw <bwarsaw@cnri.reston.va.us> |
| 6 | ;; Maintainer: tools-help@anthem.nlm.nih.gov | 6 | ;; Maintainer: tools-help@anthem.nlm.nih.gov |
| 7 | ;; Created: 26-Feb-1994 | 7 | ;; Created: 26-Feb-1994 |
| 8 | ;; Version: 2.22 | 8 | ;; Version: 2.23 |
| 9 | ;; Last Modified: 1994/12/23 17:46:21 | 9 | ;; Last Modified: 1994/12/28 22:39:31 |
| 10 | ;; Keywords: Emacs Lisp Profile Timing | 10 | ;; Keywords: Emacs Lisp Profile Timing |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| @@ -27,34 +27,33 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Commentary: | 28 | ;;; Commentary: |
| 29 | ;; | 29 | ;; |
| 30 | ;; Here are some brief usage notes. If you want to profile a bunch of | 30 | ;; If you want to profile a bunch of functions, set elp-function-list |
| 31 | ;; functions, set elp-function-list to the list of symbols, then call | 31 | ;; to the list of symbols, then do a M-x elp-instrument-list. This |
| 32 | ;; elp-instrument-list. This hacks the functions so that profiling | 32 | ;; hacks those functions so that profiling information is recorded |
| 33 | ;; information is recorded whenever they are called. To print out the | 33 | ;; whenever they are called. To print out the current results, use |
| 34 | ;; current results, use elp-results. With elp-reset-after-results set | 34 | ;; M-x elp-results. With elp-reset-after-results set to non-nil, |
| 35 | ;; to non-nil, profiling information will be reset whenever the | 35 | ;; profiling information will be reset whenever the results are |
| 36 | ;; results are displayed. You can also reset all profiling info at | 36 | ;; displayed. You can also reset all profiling info at any time with |
| 37 | ;; any time with elp-reset-all. | 37 | ;; M-x elp-reset-all. |
| 38 | ;; | 38 | ;; |
| 39 | ;; You can also instrument all functions in a package, provided that | 39 | ;; You can also instrument all functions in a package, provided that |
| 40 | ;; the package follows the GNU coding standard of a common textural | 40 | ;; the package follows the GNU coding standard of a common textural |
| 41 | ;; prefix. Use the elp-instrument-package command for this. | 41 | ;; prefix. Use M-x elp-instrument-package for this. |
| 42 | ;; | 42 | ;; |
| 43 | ;; If you want to sort the results, set elp-sort-by-function to some | 43 | ;; If you want to sort the results, set elp-sort-by-function to some |
| 44 | ;; predicate function. The three most obvious choices are predefined: | 44 | ;; predicate function. The three most obvious choices are predefined: |
| 45 | ;; elp-sort-by-call-count, elp-sort-by-average-time, and | 45 | ;; elp-sort-by-call-count, elp-sort-by-average-time, and |
| 46 | ;; elp-sort-by-total-time. Also, you can prune from the output | 46 | ;; elp-sort-by-total-time. Also, you can prune from the output, all |
| 47 | ;; display, all functions that have been called fewer than a given | 47 | ;; functions that have been called fewer than a given number of times |
| 48 | ;; number of times by setting elp-report-limit to that number. | 48 | ;; by setting elp-report-limit. |
| 49 | ;; | 49 | ;; |
| 50 | ;; Elp can instrument byte-compiled functions just as easily as | 50 | ;; Elp can instrument byte-compiled functions just as easily as |
| 51 | ;; interpreted functions, but it cannot instrument macros. However, | 51 | ;; interpreted functions, but it cannot instrument macros. However, |
| 52 | ;; when you redefine a function (e.g. with eval-defun), you'll need to | 52 | ;; when you redefine a function (e.g. with eval-defun), you'll need to |
| 53 | ;; re-instrument it with elp-instrument-function. Re-instrumenting | 53 | ;; re-instrument it with M-x elp-instrument-function. This will also |
| 54 | ;; resets profiling information for that function. Elp can also | 54 | ;; reset profiling information for that function. Elp can handle |
| 55 | ;; handle interactive functions (i.e. commands), but of course any | 55 | ;; interactive functions (i.e. commands), but of course any time spent |
| 56 | ;; time spent idling for user prompts will show up in the timing | 56 | ;; idling for user prompts will show up in the timing results. |
| 57 | ;; results. | ||
| 58 | ;; | 57 | ;; |
| 59 | ;; You can also designate a `master' function. Profiling times will | 58 | ;; You can also designate a `master' function. Profiling times will |
| 60 | ;; be gathered for instrumented functions only during execution of | 59 | ;; be gathered for instrumented functions only during execution of |
| @@ -66,9 +65,9 @@ | |||
| 66 | ;; | 65 | ;; |
| 67 | ;; and you want to find out the amount of time spent in bar and foo, | 66 | ;; and you want to find out the amount of time spent in bar and foo, |
| 68 | ;; but only during execution of bar, make bar the master. The call of | 67 | ;; but only during execution of bar, make bar the master. The call of |
| 69 | ;; foo from baz will not add to foo's total timing sums. Use | 68 | ;; foo from baz will not add to foo's total timing sums. Use M-x |
| 70 | ;; elp-set-master and elp-unset-master to utilize this feature. Only | 69 | ;; elp-set-master and M-x elp-unset-master to utilize this feature. |
| 71 | ;; one master function can be used at a time. | 70 | ;; Only one master function can be set at a time. |
| 72 | 71 | ||
| 73 | ;; You can restore any function's original function definition with | 72 | ;; You can restore any function's original function definition with |
| 74 | ;; elp-restore-function. The other instrument, restore, and reset | 73 | ;; elp-restore-function. The other instrument, restore, and reset |
| @@ -105,6 +104,20 @@ | |||
| 105 | ;; elp-results | 104 | ;; elp-results |
| 106 | ;; elp-submit-bug-report | 105 | ;; elp-submit-bug-report |
| 107 | 106 | ||
| 107 | ;; Note that there are plenty of factors that could make the times | ||
| 108 | ;; reported unreliable, including the accuracy and granularity of your | ||
| 109 | ;; system clock, and the overhead spent in lisp calculating and | ||
| 110 | ;; recording the intervals. I figure the latter is pretty constant, | ||
| 111 | ;; so while the times may not be entirely accurate, I think they'll | ||
| 112 | ;; give you a good feel for the relative amount of work spent in the | ||
| 113 | ;; various lisp routines you are profiling. Note further that times | ||
| 114 | ;; are calculated using wall-clock time, so other system load will | ||
| 115 | ;; affect accuracy too. You cannot profile anything longer than ~18 | ||
| 116 | ;; hours since I throw away the most significant 16 bits of seconds | ||
| 117 | ;; returned by current-time: 2^16 == 65536 seconds == ~1092 minutes == | ||
| 118 | ;; ~18 hours. I doubt you will ever want to profile stuff on the | ||
| 119 | ;; order of 18 hours anyway. | ||
| 120 | |||
| 108 | ;;; Background: | 121 | ;;; Background: |
| 109 | 122 | ||
| 110 | ;; This program is based on the only two existing Emacs Lisp profilers | 123 | ;; This program is based on the only two existing Emacs Lisp profilers |
| @@ -118,11 +131,7 @@ | |||
| 118 | ;; Unlike previous profilers, elp uses Emacs 19's built-in function | 131 | ;; Unlike previous profilers, elp uses Emacs 19's built-in function |
| 119 | ;; current-time to return interval times. This obviates the need for | 132 | ;; current-time to return interval times. This obviates the need for |
| 120 | ;; both an external C program and Emacs processes to communicate with | 133 | ;; both an external C program and Emacs processes to communicate with |
| 121 | ;; such a program, and thus simplifies the package as a whole. One | 134 | ;; such a program, and thus simplifies the package as a whole. |
| 122 | ;; small shortcut: I throw away the most significant 16 bits of | ||
| 123 | ;; seconds returned by current-time since I doubt anyone will ever | ||
| 124 | ;; want to profile stuff on the order of 18 hours. 2^16 == 65536 | ||
| 125 | ;; seconds == ~1092 minutes == ~18 hours. | ||
| 126 | 135 | ||
| 127 | ;;; Code: | 136 | ;;; Code: |
| 128 | 137 | ||
| @@ -163,7 +172,7 @@ functions will be displayed.") | |||
| 163 | ;; end user configuration variables | 172 | ;; end user configuration variables |
| 164 | 173 | ||
| 165 | 174 | ||
| 166 | (defconst elp-version "2.22" | 175 | (defconst elp-version "2.23" |
| 167 | "ELP version number.") | 176 | "ELP version number.") |
| 168 | 177 | ||
| 169 | (defconst elp-help-address "tools-help@anthem.nlm.nih.gov" | 178 | (defconst elp-help-address "tools-help@anthem.nlm.nih.gov" |