annotate lisp/diagnose.el @ 4506:bd28481bb0e1

Port #'window-buffer-height, #'fit-window-to-buffer, & window, buf, functions. lisp/ChangeLog addition: 2008-08-31 Aidan Kehoe <kehoea@parhasard.net> * window.el (only-window-p): New. Check if WINDOW is the only window in some context, normally its frame. (one-window-p): Implemented this in terms of #'only-window-p, calling it on the selected window. (window-buffer-height): Uncomment this, make it work. (count-screen-lines): Support a BUFFER argument. (fit-window-to-buffer): Uncomment this, correct its implementation to work with XEmacs. * help.el (temp-buffer-resize-mode): New. Name taken from GNU, implementation our own. * (resize-temp-buffer-window): New. GNU-compatible alias for #'shrink-window-if-larger-than-buffer. * dumped-lisp.el (preloaded-file-list): Move easy-mmode before help, now that the latter uses #'define-minor-mode. * frame.el: Point to #'temp-buffer-resize-mode in a comment. Some of this code is from GNU; help.el CVS version 1.327 of 2007-03-21, window.el CVS version 1.122, of 2007-06-24. Both these are GPLV2 or later.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 31 Aug 2008 12:26:46 +0200
parents b4f4e0cc90f1
children c8f90d61dcf3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
1 ;;; diagnose.el --- routines for debugging problems in XEmacs
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
2
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
3 ;; Copyright (C) 2002 Ben Wing.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
4
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
5 ;; Maintainer: XEmacs Development Team
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
6 ;; Keywords: dumped
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
7
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
8 ;; This file is part of XEmacs.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
9
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
13 ;; any later version.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
14
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
18 ;; General Public License for more details.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
19
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
23 ;; 02111-1307, USA.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
24
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
26
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
27 ;;; Commentary:
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
28
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
29 ;; This file is dumped with XEmacs.
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
30
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
31 ;;; Code:
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
32
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
33
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
34 (defun show-memory-usage ()
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
35 "Show statistics about memory usage of various sorts in XEmacs."
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
36 (interactive)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
37 (garbage-collect)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
38 (flet ((show-foo-stats (objtypename objlist memfun)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
39 (let* ((hash (make-hash-table))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
40 (first t)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
41 types fmt
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
42 (objnamelen 25)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
43 (linelen objnamelen)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
44 (totaltotal 0))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
45 (dolist (obj objlist)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
46 (let ((total 0)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
47 (stats (funcall memfun obj)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
48 (loop for (type . num) in stats while type do
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
49 (puthash type (+ num (or (gethash type hash) 0)) hash)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
50 (incf total num)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
51 (if first (push type types)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
52 (incf totaltotal total)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
53 (when first
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
54 (setq types (nreverse types))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
55 (setq fmt (concat
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
56 (format "%%-%ds" objnamelen)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
57 (mapconcat
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
58 #'(lambda (type)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
59 (let ((fieldlen
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
60 (max 8 (+ 2 (length
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
61 (symbol-name type))))))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
62 (incf linelen fieldlen)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
63 (format "%%%ds" fieldlen)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
64 types "")
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
65 (progn (incf linelen 9) "%9s\n")))
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
66 (princ "\n")
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
67 (princ (apply 'format fmt objtypename
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
68 (append types (list 'total))))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
69 (princ (make-string linelen ?-))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
70 (princ "\n"))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
71 (let ((objname (format "%s" obj)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
72 (princ (apply 'format fmt (substring objname 0
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
73 (min (length objname)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
74 (1- objnamelen)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
75 (nconc (mapcar #'(lambda (type)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
76 (cdr (assq type stats)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
77 types)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
78 (list total)))))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
79 (setq first nil)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
80 (princ "\n")
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
81 (princ (apply 'format fmt "total"
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
82 (nconc (mapcar #'(lambda (type)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
83 (gethash type hash))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
84 types)
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
85 (list totaltotal))))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
86 totaltotal)))
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
87
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
88 (let ((grandtotal 0)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
89 (buffer "*memory usage*")
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
90 begin)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
91 (with-output-to-temp-buffer buffer
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
92 (save-excursion
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
93 (set-buffer buffer)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
94 (when-fboundp 'charset-list
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
95 (setq begin (point))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
96 (incf grandtotal
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
97 (show-foo-stats 'charset (charset-list)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
98 #'charset-memory-usage))
3066
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
99 (when-fboundp 'sort-numeric-fields
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
100 (sort-numeric-fields -1
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
101 (save-excursion
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
102 (goto-char begin)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
103 (forward-line 2)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
104 (point))
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
105 (save-excursion
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
106 (forward-line -2)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
107 (point))))
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
108 (princ "\n"))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
109 (setq begin (point))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
110 (incf grandtotal
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
111 (show-foo-stats 'buffer (buffer-list) #'buffer-memory-usage))
3066
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
112 (when-fboundp 'sort-numeric-fields
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
113 (sort-numeric-fields -1
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
114 (save-excursion
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
115 (goto-char begin)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
116 (forward-line 3)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
117 (point))
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
118 (save-excursion
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
119 (forward-line -2)
a88e6130a523 [xemacs-hg @ 2005-11-13 10:56:09 by ben]
ben
parents: 3041
diff changeset
120 (point))))
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
121 (princ "\n")
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
122 (setq begin (point))
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
123 (incf grandtotal
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
124 (show-foo-stats 'window (mapcan #'(lambda (fr)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
125 (window-list fr t))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
126 (frame-list))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
127 #'window-memory-usage))
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
128 (when-fboundp #'sort-numeric-fields
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
129 (sort-numeric-fields -1
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
130 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
131 (goto-char begin)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
132 (forward-line 3)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
133 (point))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
134 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
135 (forward-line -2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
136 (point))))
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
137 (princ "\n")
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
138 (let ((total 0)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
139 (fmt "%-30s%10s\n"))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
140 (setq begin (point))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
141 (princ (format fmt "object" "storage"))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
142 (princ (make-string 40 ?-))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
143 (princ "\n")
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
144 (map-plist #'(lambda (stat num)
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
145 (when (string-match
3278
aa0d3b22be72 [xemacs-hg @ 2006-03-12 09:10:35 by crestani]
crestani
parents: 3092
diff changeset
146 "\\(.*\\)-storage$"
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
147 (symbol-name stat))
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
148 (incf total num)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
149 (princ (format fmt
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
150 (match-string 1 (symbol-name stat))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
151 num)))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
152 (when (eq stat 'long-strings-total-length)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
153 (incf total num)
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
154 (princ (format fmt stat num))))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
155 (sixth (garbage-collect)))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
156 (princ "\n")
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
157 (princ (format fmt "total" total))
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
158 (incf grandtotal total))
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
159 (when-fboundp #'sort-numeric-fields
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
160 (sort-numeric-fields -1
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
161 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
162 (goto-char begin)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
163 (forward-line 2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
164 (point))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
165 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
166 (forward-line -2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
167 (point))))
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
168
2618
6db7dbf7f88b [xemacs-hg @ 2005-02-28 07:43:17 by adrian]
adrian
parents: 787
diff changeset
169 (princ (format "\n\ngrand total: %s\n" grandtotal)))
787
242b62e9fc59 [xemacs-hg @ 2002-03-20 10:20:48 by ben]
ben
parents:
diff changeset
170 grandtotal))))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
171
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
172
3041
876730d84b73 [xemacs-hg @ 2005-11-02 03:26:51 by crestani]
crestani
parents: 2775
diff changeset
173 (defun show-object-memory-usage-stats ()
3888
099851392ea7 [xemacs-hg @ 2007-03-30 14:38:39 by stephent]
stephent
parents: 3320
diff changeset
174 "Show statistics about object memory usage in XEmacs."
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
175 (interactive)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
176 (garbage-collect)
3041
876730d84b73 [xemacs-hg @ 2005-11-02 03:26:51 by crestani]
crestani
parents: 2775
diff changeset
177 (let ((buffer "*object memory usage statistics*")
876730d84b73 [xemacs-hg @ 2005-11-02 03:26:51 by crestani]
crestani
parents: 2775
diff changeset
178 (plist (object-memory-usage-stats))
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
179 (fmt "%-30s%10s%10s\n")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
180 (grandtotal 0)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
181 begin)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
182 (flet ((show-stats (match-string)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
183 (princ (format fmt "object" "count" "storage"))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
184 (princ (make-string 50 ?-))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
185 (princ "\n")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
186 (let ((total-use 0)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
187 (total-use-overhead 0)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
188 (total-count 0))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
189 (map-plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
190 #'(lambda (stat num)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
191 (when (string-match match-string
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
192 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
193 (let ((storage-use num)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
194 (storage-use-overhead
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
195 (plist-get
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
196 plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
197 (intern (concat (match-string 1 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
198 "-storage-including-overhead"))))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
199 (storage-count
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
200 (or (plist-get
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
201 plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
202 (intern
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
203 (concat (match-string 1 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
204 "s-used")))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
205 (plist-get
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
206 plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
207 (intern
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
208 (concat (match-string 1 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
209 "es-used")))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
210 (plist-get
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
211 plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
212 (intern
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
213 (concat (match-string 1 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
214 "-used"))))))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
215 (incf total-use storage-use)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
216 (incf total-use-overhead (if storage-use-overhead
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
217 storage-use-overhead
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
218 storage-use))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
219 (incf total-count storage-count)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
220 (princ (format fmt
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
221 (match-string 1 (symbol-name stat))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
222 storage-count storage-use)))))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
223 plist)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
224 (princ "\n")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
225 (princ (format fmt "total"
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
226 total-count total-use-overhead))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
227 (incf grandtotal total-use-overhead)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
228 (when-fboundp #'sort-numeric-fields
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
229 (sort-numeric-fields -1
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
230 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
231 (goto-char begin)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
232 (forward-line 2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
233 (point))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
234 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
235 (forward-line -2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
236 (point)))))))
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
237 (with-output-to-temp-buffer buffer
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
238 (save-excursion
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
239 (set-buffer buffer)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
240 (setq begin (point))
3041
876730d84b73 [xemacs-hg @ 2005-11-02 03:26:51 by crestani]
crestani
parents: 2775
diff changeset
241 (princ "Allocated with lisp allocator:\n")
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
242 (show-stats "\\(.*\\)-storage$")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
243 (princ (format "\n\ngrand total: %s\n" grandtotal)))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
244 grandtotal))))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
245
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
246
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
247 (defun show-mc-alloc-memory-usage ()
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
248 "Show statistics about memory usage of the new allocator."
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
249 (interactive)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
250 (garbage-collect)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
251 (if-fboundp #'mc-alloc-memory-usage
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
252 (let* ((stats (mc-alloc-memory-usage))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
253 (page-size (first stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
254 (heap-sects (second stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
255 (used-plhs (third stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
256 (free-plhs (fourth stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
257 (globals (fifth stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
258 (mc-malloced-bytes (sixth stats)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
259 (with-output-to-temp-buffer "*mc-alloc memory usage*"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
260 (flet ((print-used-plhs (text plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
261 (let ((sum-n-pages 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
262 (sum-used-n-cells 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
263 (sum-used-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
264 (sum-used-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
265 (sum-total-n-cells 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
266 (sum-total-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
267 (sum-total-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
268 (fmt "%7s%7s|%7s%9s%9s%4s|%7s%9s%9s%4s|%4s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
269 (princ (format "%-14s|%-29s|%-29s|\n"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
270 text
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
271 " currently in use"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
272 " total available"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
273 (princ (format fmt "cell-sz" "#pages"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
274 "#cells" "space" "total" "% "
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
275 "#cells" "space" "total" "% " "% "))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
276 (princ (make-string 79 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
277 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
278 (while plhs
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
279 (let* ((elem (car plhs))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
280 (cell-size (first elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
281 (n-pages (second elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
282 (used-n-cells (third elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
283 (used-space (fourth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
284 (used-total (if (zerop cell-size)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
285 (sixth elem)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
286 (* cell-size used-n-cells)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
287 (used-eff (floor (if (not (zerop used-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
288 (* (/ (* used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
289 (* used-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
290 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
291 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
292 (total-n-cells (fifth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
293 (total-space (if (zerop cell-size)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
294 used-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
295 (* cell-size total-n-cells)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
296 (total-total (sixth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
297 (total-eff (floor (if (not (zerop total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
298 (* (/ (* total-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
299 (* total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
300 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
301 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
302 (eff (floor (if (not (zerop total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
303 (* (/ (* used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
304 (* total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
305 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
306 0))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
307 (princ (format fmt
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
308 cell-size n-pages used-n-cells used-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
309 used-total used-eff total-n-cells
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
310 total-space total-total total-eff eff))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
311 (incf sum-n-pages n-pages)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
312 (incf sum-used-n-cells used-n-cells)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
313 (incf sum-used-space used-space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
314 (incf sum-used-total used-total)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
315 (incf sum-total-n-cells total-n-cells)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
316 (incf sum-total-space total-space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
317 (incf sum-total-total total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
318 (setq plhs (cdr plhs)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
319 (let ((avg-used-eff (floor (if (not (zerop sum-used-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
320 (* (/ (* sum-used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
321 (* sum-used-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
322 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
323 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
324 (avg-total-eff (floor (if (not (zerop sum-total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
325 (* (/ (* sum-total-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
326 (* sum-total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
327 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
328 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
329 (avg-eff (floor (if (not (zerop sum-total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
330 (* (/ (* sum-used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
331 (* sum-total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
332 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
333 0))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
334 (princ (format fmt "sum " sum-n-pages sum-used-n-cells
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
335 sum-used-space sum-used-total avg-used-eff
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
336 sum-total-n-cells sum-total-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
337 sum-total-total avg-total-eff avg-eff))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
338 (princ "\n"))))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
339
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
340
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
341 (print-free-plhs (text plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
342 (let ((sum-n-pages 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
343 (sum-n-sects 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
344 (sum-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
345 (sum-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
346 (fmt "%6s%10s |%7s%10s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
347 (princ (format "%s\n" text))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
348 (princ (format fmt "#pages" "space" "#sects" "total"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
349 (princ (make-string 35 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
350 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
351 (while plhs
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
352 (let* ((elem (car plhs))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
353 (n-pages (first elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
354 (n-sects (second elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
355 (space (* n-pages page-size))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
356 (total (* n-sects space)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
357 (princ (format fmt n-pages space n-sects total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
358 (incf sum-n-pages n-pages)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
359 (incf sum-n-sects n-sects)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
360 (incf sum-space space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
361 (incf sum-total total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
362 (setq plhs (cdr plhs)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
363 (princ (make-string 35 ?=))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
364 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
365 (princ (format fmt sum-n-pages sum-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
366 sum-n-sects sum-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
367 (princ "\n"))))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
368
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
369 (princ (format "%-12s%10s\n\n" "PAGE_SIZE" page-size))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
370
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
371 (print-used-plhs "USED HEAP" used-plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
372 (princ "\n\n")
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
373
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
374 (print-free-plhs "FREE HEAP" free-plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
375 (princ "\n\n")
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
376
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
377 (let ((fmt "%-30s%10s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
378 (princ (format fmt "heap sections" ""))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
379 (princ (make-string 40 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
380 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
381 (princ (format fmt "number of heap sects"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
382 (first heap-sects)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
383 (princ (format fmt "used size" (second heap-sects)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
384 (princ (make-string 40 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
385 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
386 (princ (format fmt "real size" (third heap-sects)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
387 (princ (format fmt "global allocator structs" globals))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
388 (princ (make-string 40 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
389 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
390 (princ (format fmt "real size + structs"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
391 (+ (third heap-sects) globals)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
392 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
393 (princ (make-string 40 ?=))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
394 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
395 (princ (format fmt "grand total" mc-malloced-bytes)))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
396
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
397 (+ mc-malloced-bytes))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
398 (message "mc-alloc not used in this XEmacs.")))
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
399
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
400
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
401 (defun show-gc-stats ()
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
402 "Show statistics about garbage collection cycles."
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
403 (interactive)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
404 (if-fboundp #'gc-stats
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
405 (let ((buffer "*garbage collection statistics*")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
406 (plist (gc-stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
407 (fmt "%-9s %16s %12s %12s %12s %12s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
408 (flet ((plist-get-stat (category field)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
409 (let ((stat (plist-get plist
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
410 (intern (concat category field)))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
411 (if stat
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
412 (format "%.0f" stat)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
413 "-")))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
414 (show-stats (category)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
415 (princ (format fmt category
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
416 (plist-get-stat category "-total")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
417 (plist-get-stat category "-in-last-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
418 (plist-get-stat category "-in-this-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
419 (plist-get-stat category "-in-last-cycle")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
420 (plist-get-stat category "-in-this-cycle")))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
421 (with-output-to-temp-buffer buffer
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
422 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
423 (set-buffer buffer)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
424 (princ (format "%s %g\n" "Current phase"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
425 (plist-get plist 'phase)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
426 (princ (make-string 78 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
427 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
428 (princ (format fmt "stat" "total" "last-gc" "this-gc"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
429 "last-cycle" "this-cylce"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
430 (princ (make-string 78 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
431 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
432 (show-stats "n-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
433 (show-stats "n-cycles")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
434 (show-stats "enqueued")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
435 (show-stats "dequeued")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
436 (show-stats "repushed")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
437 (show-stats "enqueued2")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
438 (show-stats "dequeued2")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
439 (show-stats "finalized")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
440 (show-stats "freed")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
441 (plist-get plist 'n-gc-total)))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
442 (error 'void-function "gc-stats not available.")))