Commits

Anonymous committed fa4c576

Add toggle-profiling

profile.el: Add toggle-profiling.

  • Participants
  • Parent commits e28fda0

Comments (0)

Files changed (2)

+2004-11-13  Ben Wing  <ben@xemacs.org>
+
+	* profile.el:
+	* profile.el (profile):
+	* profile.el (toggle-profiling): New.
+	Add toggle-profiling.
+
+2004-11-09  Ben Wing  <ben@xemacs.org>
+
+	* patcher.el:
+	* patcher.el (defvar):
+	* patcher.el (patcher-diff-base):
+	* patcher.el (patcher-after-send):
+	Keep track of whether we loaded a ChangeLog and hence can kill it.
+
+	* patcher.el (patcher-generate-change-logs):
+	Move point to the beginning of the inserted entry so that it's sure
+	to be visible.  Clean up code and use save-restriction.
+	
+2004-11-07  Ben Wing  <ben@xemacs.org>
+
+	* patcher.el (patcher-mail-compose-mail):
+	Fix grammar in doc.
+	
+	* patcher.el (patcher-mail-1):
+	Extent should be detachable, otherwise subject-prefix extents
+	may sit around from the previous mail message and screw things up.
+
+2004-11-04  Ben Wing  <ben@xemacs.org>
+
+	* patcher.el (patcher-logmsg-commit):
+	buffer -> output-buffer for clarity.
+	run substitute-command-keys in the right buffer.
+
+2004-11-02  Ben Wing  <ben@xemacs.org>
+
+	* patcher.el: Put the default file argument for Files: in the
+		buffer itself rather than just as a default.
+
 2004-11-09  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.66 released.
 ;;; profile.el --- basic profiling commands for XEmacs
 
-;; Copyright (C) 1996, 2002, 2003 Ben Wing.
+;; Copyright (C) 1996, 2002, 2003, 2004 Ben Wing.
 ;; Copyright (C) 1997 Free Software Foundation.
 
 ;; Author: Ben Wing <ben@xemacs.org>
 ;;
 ;; -- High-level interactive commands for profiling key sequences, commands,
 ;;    and expressions (`profile-key-sequence', `profile-command',
-;;    `profile-expression').
+;;    `profile-expression'), or for interactively profiling any sequence of
+;;    commands (`toggle-profiling').
 ;;
 ;; -- Functions for profiling forms, optionally byte-compiled (`profile',
 ;;    `continue-profile', `compile-and-profile',
 ;;
 ;; For instance, to see where Gnus spends time when generating
 ;; Summary buffer, go to the group buffer and press
-;; `M-x profile-key-sequence RET SPC'.
+;; `M-x profile-key-sequence RET SPC'; or just do
+;; `M-x toggle-profiling', hit SPC, and do `M-x toggle-profiling' again.
+;; (This is especially convenient if you bind `toggle-profiling' to a
+;; keystroke.)
 
 
 ;;; Code:
 sequences, commands, and expressions, see `profile-key-sequence',
 `profile-command', and `profile-expression'.
 
+See also `toggle-profiling', which lets you easily profile any sequence
+of commands.
+
 If you need more control over what is profiled and what isn't, use the more
 basic functions `clear-profiling-info', `start-profiling',
 `stop-profiling', `profile-results', `get-profiling-info',
     (profile (mapc 'dispatch-event keys))))
 
 ;;;###autoload
+(defun toggle-profiling ()
+  "Start profiling, or stop it and print results.
+This lets you figure out where time is being spent when executing Lisp code."
+  (interactive)  
+  (if (profiling-active-p) 
+      (progn  
+	(stop-profiling) 
+	(message "...Finished profiling")
+	(profile-results))
+    (message "Profiling...") 
+    (clear-profiling-info) 
+    (start-profiling)))
+
+;;;###autoload
 (defmacro compile-and-profile (&rest forms)
   "Byte compile FORMS, profile the execution, and pretty-print the results."
   `(progn