annotate lisp/diagnose.el @ 5067:7d7ae8db0341

add functions `stable-union' and `stable-intersection' to do stable set operations -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2010-02-22 Ben Wing <ben@xemacs.org> * cl-seq.el: * cl-seq.el (stable-union): New. * cl-seq.el (stable-intersection): New. New functions to do stable set operations, i.e. preserve the order of the elements in the argument lists, and prefer LIST1 over LIST2 when ordering the combined result. The result looks as much like LIST1 as possible, followed (in the case of `stable-union') by any necessary elements from LIST2, in order. This is contrary to `union' and `intersection', which are not required to be order- preserving and are not -- they prefer LIST2 and output results in backwards order.
author Ben Wing <ben@xemacs.org>
date Mon, 22 Feb 2010 21:23:02 -0600
parents c8f90d61dcf3
children 1fae11d56ad2
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
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
3 ;; Copyright (C) 2002, 2010 Ben Wing.
787
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
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
200 (or (loop for str in '("s-used" "es-used" "-used")
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
201 for val = (plist-get
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
202 plist
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
203 (intern
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
204 (concat (match-string
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
205 1 (symbol-name stat))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
206 str)))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
207 if val
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
208 return val)
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
209 (plist-get
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
210 plist
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
211 (intern
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
212 (concat (substring
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
213 (match-string 1 (symbol-name stat))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
214 0 -1)
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
215 "ies-used")))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
216 )))
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
217 (incf total-use storage-use)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
218 (incf total-use-overhead (if storage-use-overhead
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
219 storage-use-overhead
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
220 storage-use))
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
221 (incf total-count (or storage-count 0))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
222 (and (> storage-use 0)
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
223 (princ (format fmt
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
224 (match-string 1 (symbol-name stat))
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
225 (or storage-count "unknown")
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
226 storage-use))))))
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
227 plist)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
228 (princ "\n")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
229 (princ (format fmt "total"
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
230 total-count total-use-overhead))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
231 (incf grandtotal total-use-overhead)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
232 (when-fboundp #'sort-numeric-fields
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
233 (sort-numeric-fields -1
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 (goto-char begin)
5059
c8f90d61dcf3 fix memory usage stats to include pdumped objects
Ben Wing <ben@xemacs.org>
parents: 4103
diff changeset
236 (forward-line 3)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
237 (point))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
238 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
239 (forward-line -2)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
240 (point)))))))
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
241 (with-output-to-temp-buffer buffer
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
242 (save-excursion
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
243 (set-buffer buffer)
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
244 (setq begin (point))
3041
876730d84b73 [xemacs-hg @ 2005-11-02 03:26:51 by crestani]
crestani
parents: 2775
diff changeset
245 (princ "Allocated with lisp allocator:\n")
2775
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
246 (show-stats "\\(.*\\)-storage$")
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
247 (princ (format "\n\ngrand total: %s\n" grandtotal)))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
248 grandtotal))))
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
249
05d62157e048 [xemacs-hg @ 2005-05-15 16:37:52 by crestani]
crestani
parents: 2720
diff changeset
250
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
251 (defun show-mc-alloc-memory-usage ()
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
252 "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
253 (interactive)
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
254 (garbage-collect)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
255 (if-fboundp #'mc-alloc-memory-usage
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
256 (let* ((stats (mc-alloc-memory-usage))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
257 (page-size (first stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
258 (heap-sects (second stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
259 (used-plhs (third stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
260 (free-plhs (fourth stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
261 (globals (fifth stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
262 (mc-malloced-bytes (sixth stats)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
263 (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
264 (flet ((print-used-plhs (text plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
265 (let ((sum-n-pages 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
266 (sum-used-n-cells 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
267 (sum-used-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
268 (sum-used-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
269 (sum-total-n-cells 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
270 (sum-total-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
271 (sum-total-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
272 (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
273 (princ (format "%-14s|%-29s|%-29s|\n"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
274 text
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
275 " currently in use"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
276 " total available"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
277 (princ (format fmt "cell-sz" "#pages"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
278 "#cells" "space" "total" "% "
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
279 "#cells" "space" "total" "% " "% "))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
280 (princ (make-string 79 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
281 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
282 (while plhs
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
283 (let* ((elem (car plhs))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
284 (cell-size (first elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
285 (n-pages (second elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
286 (used-n-cells (third elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
287 (used-space (fourth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
288 (used-total (if (zerop cell-size)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
289 (sixth elem)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
290 (* cell-size used-n-cells)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
291 (used-eff (floor (if (not (zerop used-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
292 (* (/ (* used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
293 (* used-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
294 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
295 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
296 (total-n-cells (fifth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
297 (total-space (if (zerop cell-size)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
298 used-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
299 (* cell-size total-n-cells)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
300 (total-total (sixth elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
301 (total-eff (floor (if (not (zerop total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
302 (* (/ (* total-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
303 (* total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
304 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
305 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
306 (eff (floor (if (not (zerop total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
307 (* (/ (* used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
308 (* total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
309 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
310 0))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
311 (princ (format fmt
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
312 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
313 used-total used-eff total-n-cells
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
314 total-space total-total total-eff eff))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
315 (incf sum-n-pages n-pages)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
316 (incf sum-used-n-cells used-n-cells)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
317 (incf sum-used-space used-space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
318 (incf sum-used-total used-total)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
319 (incf sum-total-n-cells total-n-cells)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
320 (incf sum-total-space total-space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
321 (incf sum-total-total total-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
322 (setq plhs (cdr plhs)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
323 (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
324 (* (/ (* sum-used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
325 (* sum-used-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
326 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
327 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
328 (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
329 (* (/ (* sum-total-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
330 (* sum-total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
331 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
332 0)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
333 (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
334 (* (/ (* sum-used-space 1.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
335 (* sum-total-total 1.0))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
336 100.0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
337 0))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
338 (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
339 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
340 sum-total-n-cells sum-total-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
341 sum-total-total avg-total-eff avg-eff))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
342 (princ "\n"))))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
343
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
344
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
345 (print-free-plhs (text plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
346 (let ((sum-n-pages 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
347 (sum-n-sects 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
348 (sum-space 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
349 (sum-total 0)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
350 (fmt "%6s%10s |%7s%10s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
351 (princ (format "%s\n" text))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
352 (princ (format fmt "#pages" "space" "#sects" "total"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
353 (princ (make-string 35 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
354 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
355 (while plhs
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
356 (let* ((elem (car plhs))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
357 (n-pages (first elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
358 (n-sects (second elem))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
359 (space (* n-pages page-size))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
360 (total (* n-sects space)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
361 (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
362 (incf sum-n-pages n-pages)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
363 (incf sum-n-sects n-sects)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
364 (incf sum-space space)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
365 (incf sum-total total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
366 (setq plhs (cdr plhs)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
367 (princ (make-string 35 ?=))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
368 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
369 (princ (format fmt sum-n-pages sum-space
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
370 sum-n-sects sum-total))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
371 (princ "\n"))))
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
372
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
373 (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
374
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
375 (print-used-plhs "USED HEAP" used-plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
376 (princ "\n\n")
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
377
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
378 (print-free-plhs "FREE HEAP" free-plhs)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
379 (princ "\n\n")
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents: 2618
diff changeset
380
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
381 (let ((fmt "%-30s%10s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
382 (princ (format fmt "heap sections" ""))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
383 (princ (make-string 40 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
384 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
385 (princ (format fmt "number of heap sects"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
386 (first heap-sects)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
387 (princ (format fmt "used size" (second heap-sects)))
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" (third heap-sects)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
391 (princ (format fmt "global allocator structs" globals))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
392 (princ (make-string 40 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
393 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
394 (princ (format fmt "real size + structs"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
395 (+ (third heap-sects) globals)))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
396 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
397 (princ (make-string 40 ?=))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
398 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
399 (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
400
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
401 (+ mc-malloced-bytes))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
402 (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
403
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
404
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
405 (defun show-gc-stats ()
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
406 "Show statistics about garbage collection cycles."
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 3066
diff changeset
407 (interactive)
4103
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
408 (if-fboundp #'gc-stats
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
409 (let ((buffer "*garbage collection statistics*")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
410 (plist (gc-stats))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
411 (fmt "%-9s %16s %12s %12s %12s %12s\n"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
412 (flet ((plist-get-stat (category field)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
413 (let ((stat (plist-get plist
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
414 (intern (concat category field)))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
415 (if stat
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
416 (format "%.0f" stat)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
417 "-")))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
418 (show-stats (category)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
419 (princ (format fmt category
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
420 (plist-get-stat category "-total")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
421 (plist-get-stat category "-in-last-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
422 (plist-get-stat category "-in-this-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
423 (plist-get-stat category "-in-last-cycle")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
424 (plist-get-stat category "-in-this-cycle")))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
425 (with-output-to-temp-buffer buffer
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
426 (save-excursion
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
427 (set-buffer buffer)
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
428 (princ (format "%s %g\n" "Current phase"
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
429 (plist-get plist 'phase)))
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 (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
433 "last-cycle" "this-cylce"))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
434 (princ (make-string 78 ?-))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
435 (princ "\n")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
436 (show-stats "n-gc")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
437 (show-stats "n-cycles")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
438 (show-stats "enqueued")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
439 (show-stats "dequeued")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
440 (show-stats "repushed")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
441 (show-stats "enqueued2")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
442 (show-stats "dequeued2")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
443 (show-stats "finalized")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
444 (show-stats "freed")
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
445 (plist-get plist 'n-gc-total)))))
b4f4e0cc90f1 [xemacs-hg @ 2007-08-07 23:08:47 by aidan]
aidan
parents: 3888
diff changeset
446 (error 'void-function "gc-stats not available.")))