0
|
1 ;;; profile.el --- basic profiling commands for XEmacs
|
|
2
|
|
3 ;; Copyright (C) 1996 Ben Wing.
|
|
4
|
155
|
5 ;; Maintainer: XEmacs Development Team
|
|
6 ;; Keywords: internal
|
|
7
|
0
|
8 ;; This file is part of XEmacs.
|
|
9
|
|
10 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
11 ;; under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14
|
|
15 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18 ;; General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
16
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the
|
70
|
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
16
|
23 ;; Boston, MA 02111-1307, USA.
|
0
|
24
|
|
25 ;;; Synched up with: Not in FSF.
|
|
26
|
155
|
27 ;;; Commentary:
|
|
28
|
|
29 ;;; Code:
|
|
30
|
|
31 ;;;###autoload
|
0
|
32 (defun pretty-print-profiling-info (&optional info)
|
|
33 "Print profiling info INFO to standard output in a pretty format.
|
|
34 If INFO is omitted, the current profiling info is retrieved using
|
|
35 `get-profiling-info'."
|
|
36 (if info (setq info (copy-alist info))
|
|
37 (setq info (get-profiling-info)))
|
|
38 (setq info (nreverse (sort info #'cdr-less-than-cdr)))
|
|
39 (princ "Function Count %\n")
|
|
40 (princ "---------------------------------------------------------------------\n")
|
|
41 (let ((sum 0.0)
|
|
42 (info2 info))
|
|
43 (while info2
|
|
44 (setq sum (+ sum (cdar info2)))
|
|
45 (setq info2 (cdr info2)))
|
|
46 (while info
|
|
47 (let ((f (caar info)))
|
|
48 (princ (format "%-50s%10d %6.3f\n" f (cdar info)
|
|
49 (* 100 (/ (cdar info) sum)))))
|
|
50 (setq info (cdr info)))))
|
155
|
51
|
|
52 ;;; profile.el ends here
|