unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* elp-instrument-file
@ 2010-06-17 13:13 Kevin Rodgers
  2010-07-01  1:19 ` elp-instrument-file Dan Nicolaescu
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Rodgers @ 2010-06-17 13:13 UTC (permalink / raw)
  To: emacs-devel

elp-instrument-package allows you to profile all the functions whose name begins
with a PACKAGE- prefix.  But what if you want to profile all the functions in a
a library, regardless of their name -- for example, the files.el library that is
distributed with Emacs and dumped in the executable.

(defun elp-instrument-file (file)
   "Instrument for profiling, all functions defined in FILE.
FILE is a regexp matching a key in the `load-history' alist."
   (interactive
    (list (concat "\\`"
		 (regexp-quote (completing-read "File to instrument: "
						load-history
						nil t))
		 "\\'")))
(dolist (entry (cdr (load-history-filename-element file)))
   (when (and (consp entry)
	     (eq (car entry) 'defun)
	     (elp-profilable-p (cdr entry)))
     (elp-instrument-function (cdr entry)))))

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: elp-instrument-file
  2010-06-17 13:13 elp-instrument-file Kevin Rodgers
@ 2010-07-01  1:19 ` Dan Nicolaescu
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Nicolaescu @ 2010-07-01  1:19 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: emacs-devel

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> elp-instrument-package allows you to profile all the functions whose name begins
> with a PACKAGE- prefix.  But what if you want to profile all the functions in a
> a library, regardless of their name -- for example, the files.el library that is
> distributed with Emacs and dumped in the executable.

FWIW, IMHO this is a good idea.  Please also add a menu binding in
emacs-lisp-mode when this gets installed. [What is it waiting for?]
It would also be nice to have a similar function for trace.el


>
> (defun elp-instrument-file (file)
>   "Instrument for profiling, all functions defined in FILE.
> FILE is a regexp matching a key in the `load-history' alist."
>   (interactive
>    (list (concat "\\`"
> 		 (regexp-quote (completing-read "File to instrument: "
> 						load-history
> 						nil t))
> 		 "\\'")))
> (dolist (entry (cdr (load-history-filename-element file)))
>   (when (and (consp entry)
> 	     (eq (car entry) 'defun)
> 	     (elp-profilable-p (cdr entry)))
>     (elp-instrument-function (cdr entry)))))
>
> -- 
> Kevin Rodgers
> Denver, Colorado, USA



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-01  1:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-17 13:13 elp-instrument-file Kevin Rodgers
2010-07-01  1:19 ` elp-instrument-file Dan Nicolaescu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).