+;(stop-profiling)
+
+;; yuck! need to insert the function def here, and rewrite the dolist
+;; loop below.
+
+;(defun loadup-profile-results (&optional info stream)
+; "Print profiling info INFO to STREAM in a pretty format.
+;If INFO is omitted, the current profiling info is retrieved using
+; `get-profiling-info'.
+;If STREAM is omitted, either a *Profiling Results* buffer or standard
+; output are used, depending on whether the function was called
+; interactively or not."
+; (interactive)
+; (setq info (if info
+; (copy-alist info)
+; (get-profiling-info)))
+; (when (and (not stream)
+; (interactive-p))
+; (pop-to-buffer (get-buffer-create "*Profiling Results*"))
+; (erase-buffer))
+; (let ((standard-output (or stream (if (interactive-p)
+; (current-buffer)
+; standard-output)))
+; ;; Calculate the longest function
+; (maxfunlen (apply #'max
+; (length "Function Name")
+; (mapcar
+; (lambda (el)
+; ;; Functions longer than 50 characters (usually
+; ;; anonymous functions) don't qualify
+; (let ((l (length (format "%s" (car el)))))
+; (if (< l 50)
+; l 0)))
+; info))))
+; (princ (format "%-*s Ticks %%/Total Call Count\n"
+; maxfunlen "Function Name"))
+; (princ (make-string maxfunlen ?=))
+; (princ " ===== ======= ==========\n")
+; (let ((sum (float (apply #'+ (mapcar #'cdr info)))))
+; (let (entry
+; (entry-list (nreverse (sort info #'cdr-less-than-cdr))))
+; (while entry-list
+; (setq entry (car entry-list))
+; (princ (format "%-*s %-5d %-6.3f %s\n"
+; maxfunlen (car entry) (cdr entry)
+; (* 100 (/ (cdr entry) sum))
+; (or (gethash (car entry) call-count-profile-table)
+; "")))
+; (setq entry-list (cdr entry-list))))
+; (princ (make-string maxfunlen ?-))
+; (princ "---------------------------------\n")
+; (princ (format "%-*s %-5d %-6.2f\n" maxfunlen "Total" sum 100.0))
+; (princ (format "\n\nOne tick = %g ms\n"
+; (/ default-profiling-interval 1000.0)))
+; (and (boundp 'internal-error-checking)
+; internal-error-checking
+; (princ "
+;WARNING: Error checking is turned on in this XEmacs. This might make
+; the measurements very unreliable.\n"))))
+; (when (and (not stream)
+; (interactive-p))
+; (goto-char (point-min))))
+
+;(loadup-profile-results nil 'external-debugging-output)
+