annotate lisp/emacs-lisp/elp.el @ 8763:2b54e6deed2f

(kill-new): New optional argument means replace most recent kill. (kill-append): Use that new interface.
author Karl Heuer <kwzh@gnu.org>
date Thu, 15 Sep 1994 21:30:21 +0000
parents ebbea7d79174
children 170c4c188d4f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; elp.el --- Emacs Lisp Profiler
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
4
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
5 ;; Author: 1994 Barry A. Warsaw <bwarsaw@cnri.reston.va.us>
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
6 ;; Maintainer: tools-help@anthem.nlm.nih.gov
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Created: 26-Feb-1994
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
8 ;; Version: 2.18
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
9 ;; Last Modified: 1994/09/14 14:00:09
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; Keywords: Emacs Lisp Profile Timing
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
12 ;; This file is part of GNU Emacs.
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
17 ;; any later version.
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
18
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
23
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Commentary:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; This program is based on the only two existing Emacs Lisp profilers
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; that I'm aware of, Boaz Ben-Zvi's profile.el, and Root Boy Jim's
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; profiler.el. Both were written for Emacs 18 and both were pretty
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; good first shots at profiling, but I found that they didn't provide
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; the functionality or interface that I wanted. So I wrote this.
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
35 ;; I've tested elp in Lucid Emacs 19.9 and Emacs 19.22. There's no
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; point in even trying to make this work with Emacs 18.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; Unlike previous profilers, elp uses Emacs 19's built-in function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; current-time to return interval times. This obviates the need for
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; both an external C program and Emacs processes to communicate with
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; such a program, and thus simplifies the package as a whole. One
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; small shortcut: I throw away the most significant 16 bits of
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; seconds returned by current-time since I doubt anyone will ever
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; want to profile stuff on the order of 18 hours. 2^16 == 65536
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; seconds == ~1092 minutes == ~18 hours.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; Note that there are plenty of factors that could make the times
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; reported unreliable, including the accuracy and granularity of your
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; system clock, and the overhead spent in lisp calculating and
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; recording the intervals. The latter I figure is pretty constant
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; so, while the times may not be entirely accurate, I think they'll
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; give you a good feel for the relative amount of work spent in the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; various lisp routines you are profiling. Note further that times
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; are calculated using wall-clock time, so other system load will
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; affect accuracy too.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; There are only 3 variables you can change to customize behavior of
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; elp. See below for their description.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; Here is a list of the interactive commands you can use:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; elp-instrument-function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; elp-restore-function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; elp-instrument-list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; elp-restore-list
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
65 ;; elp-instrument-package
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; elp-restore-all
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; elp-reset-function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; elp-reset-list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; elp-reset-all
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; elp-results
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; elp-submit-bug-report
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; Here are some brief usage notes. If you want to profile a bunch of
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; functions, set elp-function-list to the list of symbols, then call
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; elp-instrument-list. This hacks the functions so that profiling
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; information is recorded whenever they are called. To print out the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; current results, use elp-results. With elp-reset-after-results set
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; to non-nil, profiling information will be reset whenever the
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
79 ;; results are displayed. You can also reset all profiling info at any
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
80 ;; time with elp-reset-all.
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
81 ;;
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
82 ;; You can also instrument all functions in a package, provided that
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
83 ;; the package follows the GNU coding standard of a common textural
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
84 ;; prefix. elp-instrument-package does this.
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;; If you want to sort the results, set elp-sort-by-function to some
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; predicate function. The three most obvious choices are predefined:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; elp-sort-by-call-count, elp-sort-by-average-time, and
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
89 ;; elp-sort-by-total-time. Also, you can prune from the output
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
90 ;; display, all functions that have been called fewer than a given
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
91 ;; number of times by setting elp-report-limit to that number.
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; Elp can instrument byte-compiled functions just as easily as
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
94 ;; interpreted functions, but it cannot instrument macros. However,
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
95 ;; when you redefine a function (e.g. with eval-defun), you'll need
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
96 ;; to re-instrument it with elp-instrument-function. Re-instrumenting
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
97 ;; resets profiling information for that function. Elp can also
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
98 ;; handle interactive functions (i.e. commands), but of course any
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
99 ;; time spent idling for user prompts will show up in the timing
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
100 ;; results.
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; You can also designate a `master' function. Profiling times will
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; be gathered for instrumented functions only during execution of
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; this master function. Thus, if you have some defuns like:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;; (defun foo () (do-something-time-intensive))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; (defun bar () (foo))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; (defun baz () (bar) (foo))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; and you want to find out the amount of time spent in bar and foo,
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;; but only during execution of bar, make bar the master and the call
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;; of foo from baz will not add to foo's total timing sums. Use
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 ;; elp-set-master and elp-unset-master to utilize this feature. Only
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; one master function can be used at a time.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;; You can restore any function's original function definition with
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;; elp-restore-function. The other instrument, restore, and reset
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;; functions are provided for symmetry.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 ;;; Code:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;; start user configuration variables
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defvar elp-function-list nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 "*List of function to profile.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (defvar elp-reset-after-results t
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 "*Non-nil means reset all profiling info after results are displayed.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 Results are displayed with the `elp-results' command.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (defvar elp-sort-by-function nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 "*Non-nil specifies elp results sorting function.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 These functions are currently available:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 elp-sort-by-call-count -- sort by the highest call count
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 elp-sort-by-total-time -- sort by the highest total time
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 elp-sort-by-average-time -- sort by the highest average times
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 You can write you're own sort function. It should adhere to the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 interface specified by the PRED argument for the `sort' defun. Each
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 \"element of LIST\" is really a 4 element vector where element 0 is
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 the call count, element 1 is the total time spent in the function,
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 element 2 is the average time spent in the function, and element 3 is
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 the symbol's name string.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
148 (defvar elp-report-limit nil
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
149 "*Prevents some functions from being displayed in the results buffer.
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
150 If a number, no function that has been called fewer than that number
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
151 of times will be displayed in the output buffer. If nil, all
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
152 functions will be displayed.")
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
153
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ;; end user configuration variables
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
159 (defconst elp-version "2.18"
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 "ELP version number.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (defconst elp-help-address "tools-help@anthem.nlm.nih.gov"
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 "Address accepting submissions of bug reports and questions.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (defvar elp-results-buffer "*ELP Profiling Results*"
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 "Buffer name for outputting profiling results.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defconst elp-timer-info-property 'elp-info
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 "ELP information property name.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (defvar elp-all-instrumented-list nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 "List of all functions currently being instrumented.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (defvar elp-record-p t
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 "Controls whether functions should record times or not.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 This variable is set by the master function.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (defvar elp-master nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 "Master function symbol.")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
182 ;;;###autoload
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (defun elp-instrument-function (funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 "Instrument FUNSYM for profiling.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 FUNSYM must be a symbol of a defined function."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (interactive "aFunction to instrument: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;; TBD what should we do if the function is already instrumented???
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (let* ((funguts (symbol-function funsym))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (infovec (vector 0 0 funguts))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (newguts '(lambda (&rest args))))
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
191 ;; we cannot profile macros
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
192 (and (eq (car-safe funguts) 'macro)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
193 (error "ELP cannot profile macro %s" funsym))
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 ;; put rest of newguts together
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (if (commandp funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (setq newguts (append newguts '((interactive)))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (setq newguts (append newguts (list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (list 'elp-wrapper
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (list 'quote funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (list 'and
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 '(interactive-p)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (not (not (commandp funsym))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 'args))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 ;; to record profiling times, we set the symbol's function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 ;; definition so that it runs the elp-wrapper function with the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 ;; function symbol as an argument. We place the old function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 ;; definition on the info vector.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 ;; The info vector data structure is a 3 element vector. The 0th
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 ;; element is the call-count, i.e. the total number of times this
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 ;; function has been entered. This value is bumped up on entry to
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 ;; the function so that non-local exists are still recorded. TBD:
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;; I haven't tested non-local exits at all, so no guarantees.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 ;; The 1st element is the total amount of time in usecs that have
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 ;; been spent inside this function. This number is added to on
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 ;; function exit.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ;;
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;; The 2nd element is the old function definition list. This gets
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ;; funcall'd in between start/end time retrievals. I believe that
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 ;; this lets us profile even byte-compiled functions.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 ;; put the info vector on the property list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 (put funsym elp-timer-info-property infovec)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 ;; set the symbol's new profiling function definition to run
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 ;; elp-wrapper
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (fset funsym newguts)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;; add this function to the instrumentation list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (or (memq funsym elp-all-instrumented-list)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (setq elp-all-instrumented-list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (cons funsym elp-all-instrumented-list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 ))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
236 ;;;###autoload
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (defun elp-restore-function (funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 "Restore an instrumented function to its original definition.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 Argument FUNSYM is the symbol of a defined function."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (interactive "aFunction to restore: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (let ((info (get funsym elp-timer-info-property)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;; delete the function from the all instrumented list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (setq elp-all-instrumented-list
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 (delq funsym elp-all-instrumented-list))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;; if the function was the master, reset the master
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (if (eq funsym elp-master)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (setq elp-master nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 elp-record-p t))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; zap the properties
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 (put funsym elp-timer-info-property nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;; restore the original function definition, but if the function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 ;; wasn't instrumented do nothing. we do this after the above
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 ;; because its possible the function got un-instrumented due to
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 ;; circumstances beyond our control. Also, check to make sure
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 ;; that the current function symbol points to elp-wrapper. If
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 ;; not, then the user probably did an eval-defun while the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 ;; function was instrumented and we don't want to destroy the new
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 ;; definition.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (and info
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 (assq 'elp-wrapper (symbol-function funsym))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (fset funsym (aref info 2)))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
266 ;;;###autoload
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (defun elp-instrument-list (&optional list)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 "Instrument for profiling, all functions in `elp-function-list'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 Use optional LIST if provided instead."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (interactive "PList of functions to instrument: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (let ((list (or list elp-function-list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (mapcar 'elp-instrument-function list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
274 ;;;###autoload
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
275 (defun elp-instrument-package (prefix)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
276 "Instrument for profiling, all functions which start with PREFIX.
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
277 For example, to instrument all ELP functions, do the following:
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
278
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
279 \\[elp-instrument-package] RET elp- RET"
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
280 (interactive "sPrefix of package to instrument: ")
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
281 (elp-instrument-list
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
282 (mapcar 'intern (all-completions prefix obarray
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
283 (function
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
284 (lambda (sym)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
285 (and (fboundp sym)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
286 (not (eq (car-safe
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
287 (symbol-function sym))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
288 'macro)))))))))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
289
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (defun elp-restore-list (&optional list)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 "Restore the original definitions for all functions in `elp-function-list'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 Use optional LIST if provided instead."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (interactive "PList of functions to restore: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (let ((list (or list elp-function-list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (mapcar 'elp-restore-function list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (defun elp-restore-all ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 "Restores the original definitions of all functions being profiled."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (interactive)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (elp-restore-list elp-all-instrumented-list))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (defun elp-reset-function (funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 "Reset the profiling information for FUNSYM."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (interactive "aFunction to reset: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (let ((info (get funsym elp-timer-info-property)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (or info
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (error "%s is not instrumented for profiling." funsym))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (aset info 0 0) ;reset call counter
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (aset info 1 0.0) ;reset total time
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 ;; don't muck with aref 2 as that is the old symbol definition
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 ))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (defun elp-reset-list (&optional list)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 "Reset the profiling information for all functions in `elp-function-list'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 Use optional LIST if provided instead."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (interactive "PList of functions to reset: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (let ((list (or list elp-function-list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (mapcar 'elp-reset-function list)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (defun elp-reset-all ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 "Reset the profiling information for all functions being profiled."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (interactive)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 (elp-reset-list elp-all-instrumented-list))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (defun elp-set-master (funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 "Set the master function for profiling."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 (interactive "aMaster function: ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ;; when there's a master function, recording is turned off by
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 ;; default
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 (setq elp-master funsym
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 elp-record-p nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 ;; make sure master function is instrumented
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (or (memq funsym elp-all-instrumented-list)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 (elp-instrument-function funsym)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (defun elp-unset-master ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 "Unsets the master function."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 ;; when there's no master function, recording is turned on by default.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (setq elp-master nil
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 elp-record-p t))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (defsubst elp-get-time ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 ;; get current time in seconds and microseconds. I throw away the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 ;; most significant 16 bits of seconds since I doubt we'll ever want
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 ;; to profile lisp on the order of 18 hours. See notes at top of file.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (let ((now (current-time)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (+ (float (nth 1 now)) (/ (float (nth 2 now)) 1000000.0))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (defun elp-wrapper (funsym interactive-p args)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 "This function has been instrumented for profiling by the ELP.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 ELP is the Emacs Lisp Profiler. To restore the function to its
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 original definition, use \\[elp-restore-function] or \\[elp-restore-all]."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 ;; turn on recording if this is the master function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (if (and elp-master
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (eq funsym elp-master))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (setq elp-record-p t))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 ;; get info vector and original function symbol
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (let* ((info (get funsym elp-timer-info-property))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (func (aref info 2))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 result)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 (or func
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (error "%s is not instrumented for profiling." funsym))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 (if (not elp-record-p)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;; when not recording, just call the original function symbol
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 ;; and return the results.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (setq result
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (if interactive-p
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (call-interactively func)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (apply func args)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 ;; we are recording times
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (let ((enter-time (elp-get-time)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 ;; increment the call-counter
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (aset info 0 (1+ (aref info 0)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 ;; now call the old symbol function, checking to see if it
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 ;; should be called interactively. make sure we return the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 ;; correct value
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (setq result
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (if interactive-p
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (call-interactively func)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (apply func args)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 ;; calculate total time in function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (aset info 1 (+ (aref info 1) (- (elp-get-time) enter-time)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 ))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 ;; turn off recording if this is the master function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (if (and elp-master
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (eq funsym elp-master))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (setq elp-record-p nil))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 result))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 ;; shut the byte-compiler up
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (defvar elp-field-len nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (defvar elp-cc-len nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (defvar elp-at-len nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (defvar elp-et-len nil)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (defun elp-sort-by-call-count (vec1 vec2)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 ;; sort by highest call count. See `sort'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 (>= (aref vec1 0) (aref vec2 0)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (defun elp-sort-by-total-time (vec1 vec2)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ;; sort by highest total time spent in function. See `sort'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (>= (aref vec1 1) (aref vec2 1)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (defun elp-sort-by-average-time (vec1 vec2)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 ;; sort by highest average time spent in function. See `sort'.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (>= (aref vec1 2) (aref vec2 2)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (defun elp-output-result (resultvec)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 ;; output the RESULTVEC into the results buffer. RESULTVEC is a 4 or
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 ;; more element vector where aref 0 is the call count, aref 1 is the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 ;; total time spent in the function, aref 2 is the average time
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 ;; spent in the function, and aref 3 is the symbol's string
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 ;; name. All other elements in the vector are ignored.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (let* ((cc (aref resultvec 0))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (tt (aref resultvec 1))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (at (aref resultvec 2))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (symname (aref resultvec 3))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 callcnt totaltime avetime)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (setq callcnt (number-to-string cc)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 totaltime (number-to-string tt)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 avetime (number-to-string at))
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
425 ;; possibly prune the results
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
426 (if (and elp-report-limit
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
427 (numberp elp-report-limit)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
428 (< cc elp-report-limit))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
429 nil
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
430 (insert symname)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
431 (insert-char 32 (+ elp-field-len (- (length symname)) 2))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
432 ;; print stuff out, formatting it nicely
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
433 (insert callcnt)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
434 (insert-char 32 (+ elp-cc-len (- (length callcnt)) 2))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
435 (if (> (length totaltime) elp-et-len)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
436 (insert (substring totaltime 0 elp-et-len) " ")
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
437 (insert totaltime)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
438 (insert-char 32 (+ elp-et-len (- (length totaltime)) 2)))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
439 (if (> (length avetime) elp-at-len)
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
440 (insert (substring avetime 0 elp-at-len))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
441 (insert avetime))
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
442 (insert "\n"))))
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
444 ;;;###autoload
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (defun elp-results ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 "Display current profiling results.
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 If `elp-reset-after-results' is non-nil, then current profiling
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 information for all instrumented functions are reset after results are
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 displayed."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (interactive)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (let ((curbuf (current-buffer))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (resultsbuf (get-buffer-create elp-results-buffer)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (set-buffer resultsbuf)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (erase-buffer)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (beginning-of-buffer)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 ;; get the length of the longest function name being profiled
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 (let* ((longest 0)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 (title "Function Name")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (titlelen (length title))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (elp-field-len titlelen)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (cc-header "Call Count")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (elp-cc-len (length cc-header))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (et-header "Elapsed Time")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (elp-et-len (length et-header))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (at-header "Average Time")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (elp-at-len (length at-header))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (resvec
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 (mapcar
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (lambda (funsym)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (let* ((info (get funsym elp-timer-info-property))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (symname (format "%s" funsym))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (cc (aref info 0))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (tt (aref info 1)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (if (not info)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (insert "No profiling information found for: "
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 symname)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (setq longest (max longest (length symname)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (vector cc tt (if (zerop cc)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 0.0 ;avoid arithmetic div-by-zero errors
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (/ (float tt) (float cc)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 symname)))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 elp-all-instrumented-list))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 ) ; end let*
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 (insert title)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (if (> longest titlelen)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (progn
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 (insert-char 32 (- longest titlelen))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (setq elp-field-len longest)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 (insert " " cc-header " " et-header " " at-header "\n")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (insert-char ?= elp-field-len)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 (insert " ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 (insert-char ?= elp-cc-len)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (insert " ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 (insert-char ?= elp-et-len)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 (insert " ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (insert-char ?= elp-at-len)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 (insert "\n")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 ;; if sorting is enabled, then sort the results list. in either
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 ;; case, call elp-output-result to output the result in the
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 ;; buffer
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (if elp-sort-by-function
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (setq resvec (sort resvec elp-sort-by-function)))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (mapcar 'elp-output-result resvec))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 ;; now pop up results buffer
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (set-buffer curbuf)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (pop-to-buffer resultsbuf)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 ;; reset profiling info if desired
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (and elp-reset-after-results
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (elp-reset-all))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (eval-when-compile
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (require 'reporter))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515
8745
ebbea7d79174 Add autoloads.
Richard M. Stallman <rms@gnu.org>
parents: 8744
diff changeset
516 ;;;###autoload
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 (defun elp-submit-bug-report ()
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 "Submit via mail, a bug report on elp."
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (interactive)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (and
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 (y-or-n-p "Do you want to submit a report on elp? ")
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (require 'reporter)
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 (reporter-submit-bug-report
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 elp-help-address (concat "elp " elp-version)
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
525 '(elp-report-limit
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
526 elp-reset-after-results
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 elp-sort-by-function))))
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (provide 'elp)
8744
e1b824af0849 Update to 2.15.
Richard M. Stallman <rms@gnu.org>
parents: 8735
diff changeset
531
8735
d1f0811de024 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 ;; elp.el ends here