Mercurial > emacs
comparison lisp/emacs-lisp/elp.el @ 8745:ebbea7d79174
Add autoloads.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 14 Sep 1994 20:24:21 +0000 |
parents | e1b824af0849 |
children | 170c4c188d4f |
comparison
equal
deleted
inserted
replaced
8744:e1b824af0849 | 8745:ebbea7d79174 |
---|---|
1 ;;; elp.el --- Emacs Lisp Profiler | 1 ;;; elp.el --- Emacs Lisp Profiler |
2 | 2 |
3 ;; Copyright (C) 1994 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1994 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: 1994 Barry A. Warsaw, Century Computing, Inc. <bwarsaw@cen.com> | 5 ;; Author: 1994 Barry A. Warsaw <bwarsaw@cnri.reston.va.us> |
6 ;; Maintainer: bwarsaw@cen.com | 6 ;; Maintainer: tools-help@anthem.nlm.nih.gov |
7 ;; Created: 26-Feb-1994 | 7 ;; Created: 26-Feb-1994 |
8 ;; Version: 2.15 | 8 ;; Version: 2.18 |
9 ;; Last Modified: 1994/07/05 13:46:02 | 9 ;; Last Modified: 1994/09/14 14:00:09 |
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. |
13 | 13 |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | 14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
30 ;; This program is based on the only two existing Emacs Lisp profilers | 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 | 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 | 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 | 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. | 34 ;; the functionality or interface that I wanted. So I wrote this. |
35 ;; I've tested elp in Lucid Emacs 19.9 and Emacs 19.22. There's no | 35 ;; I've tested elp in Lucid Emacs 19.9 and Emacs 19.22. There's no |
36 ;; point in even trying to make this work with Emacs 18. | 36 ;; point in even trying to make this work with Emacs 18. |
37 | 37 |
38 ;; Unlike previous profilers, elp uses Emacs 19's built-in function | 38 ;; Unlike previous profilers, elp uses Emacs 19's built-in function |
39 ;; current-time to return interval times. This obviates the need for | 39 ;; current-time to return interval times. This obviates the need for |
40 ;; both an external C program and Emacs processes to communicate with | 40 ;; both an external C program and Emacs processes to communicate with |
154 | 154 |
155 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 155 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
156 ;; end user configuration variables | 156 ;; end user configuration variables |
157 | 157 |
158 | 158 |
159 (defconst elp-version "2.15" | 159 (defconst elp-version "2.18" |
160 "ELP version number.") | 160 "ELP version number.") |
161 | 161 |
162 (defconst elp-help-address "tools-help@anthem.nlm.nih.gov" | 162 (defconst elp-help-address "tools-help@anthem.nlm.nih.gov" |
163 "Address accepting submissions of bug reports and questions.") | 163 "Address accepting submissions of bug reports and questions.") |
164 | 164 |
177 | 177 |
178 (defvar elp-master nil | 178 (defvar elp-master nil |
179 "Master function symbol.") | 179 "Master function symbol.") |
180 | 180 |
181 | 181 |
182 ;;;###autoload | |
182 (defun elp-instrument-function (funsym) | 183 (defun elp-instrument-function (funsym) |
183 "Instrument FUNSYM for profiling. | 184 "Instrument FUNSYM for profiling. |
184 FUNSYM must be a symbol of a defined function." | 185 FUNSYM must be a symbol of a defined function." |
185 (interactive "aFunction to instrument: ") | 186 (interactive "aFunction to instrument: ") |
186 ;; TBD what should we do if the function is already instrumented??? | 187 ;; TBD what should we do if the function is already instrumented??? |
230 (or (memq funsym elp-all-instrumented-list) | 231 (or (memq funsym elp-all-instrumented-list) |
231 (setq elp-all-instrumented-list | 232 (setq elp-all-instrumented-list |
232 (cons funsym elp-all-instrumented-list))) | 233 (cons funsym elp-all-instrumented-list))) |
233 )) | 234 )) |
234 | 235 |
236 ;;;###autoload | |
235 (defun elp-restore-function (funsym) | 237 (defun elp-restore-function (funsym) |
236 "Restore an instrumented function to its original definition. | 238 "Restore an instrumented function to its original definition. |
237 Argument FUNSYM is the symbol of a defined function." | 239 Argument FUNSYM is the symbol of a defined function." |
238 (interactive "aFunction to restore: ") | 240 (interactive "aFunction to restore: ") |
239 (let ((info (get funsym elp-timer-info-property))) | 241 (let ((info (get funsym elp-timer-info-property))) |
259 ;; definition. | 261 ;; definition. |
260 (and info | 262 (and info |
261 (assq 'elp-wrapper (symbol-function funsym)) | 263 (assq 'elp-wrapper (symbol-function funsym)) |
262 (fset funsym (aref info 2))))) | 264 (fset funsym (aref info 2))))) |
263 | 265 |
266 ;;;###autoload | |
264 (defun elp-instrument-list (&optional list) | 267 (defun elp-instrument-list (&optional list) |
265 "Instrument for profiling, all functions in `elp-function-list'. | 268 "Instrument for profiling, all functions in `elp-function-list'. |
266 Use optional LIST if provided instead." | 269 Use optional LIST if provided instead." |
267 (interactive "PList of functions to instrument: ") | 270 (interactive "PList of functions to instrument: ") |
268 (let ((list (or list elp-function-list))) | 271 (let ((list (or list elp-function-list))) |
269 (mapcar 'elp-instrument-function list))) | 272 (mapcar 'elp-instrument-function list))) |
270 | 273 |
274 ;;;###autoload | |
271 (defun elp-instrument-package (prefix) | 275 (defun elp-instrument-package (prefix) |
272 "Instrument for profiling, all functions which start with PREFIX. | 276 "Instrument for profiling, all functions which start with PREFIX. |
273 For example, to instrument all ELP functions, do the following: | 277 For example, to instrument all ELP functions, do the following: |
274 | 278 |
275 \\[elp-instrument-package] RET elp- RET" | 279 \\[elp-instrument-package] RET elp- RET" |
435 (if (> (length avetime) elp-at-len) | 439 (if (> (length avetime) elp-at-len) |
436 (insert (substring avetime 0 elp-at-len)) | 440 (insert (substring avetime 0 elp-at-len)) |
437 (insert avetime)) | 441 (insert avetime)) |
438 (insert "\n")))) | 442 (insert "\n")))) |
439 | 443 |
444 ;;;###autoload | |
440 (defun elp-results () | 445 (defun elp-results () |
441 "Display current profiling results. | 446 "Display current profiling results. |
442 If `elp-reset-after-results' is non-nil, then current profiling | 447 If `elp-reset-after-results' is non-nil, then current profiling |
443 information for all instrumented functions are reset after results are | 448 information for all instrumented functions are reset after results are |
444 displayed." | 449 displayed." |
506 | 511 |
507 | 512 |
508 (eval-when-compile | 513 (eval-when-compile |
509 (require 'reporter)) | 514 (require 'reporter)) |
510 | 515 |
516 ;;;###autoload | |
511 (defun elp-submit-bug-report () | 517 (defun elp-submit-bug-report () |
512 "Submit via mail, a bug report on elp." | 518 "Submit via mail, a bug report on elp." |
513 (interactive) | 519 (interactive) |
514 (and | 520 (and |
515 (y-or-n-p "Do you want to submit a report on elp? ") | 521 (y-or-n-p "Do you want to submit a report on elp? ") |