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