summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-18 09:44:36 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-18 09:44:36 +0400
commit3ab6e069695d0dd5bb77133a89f858190ab8550a (patch)
treebd50490ec50ec8d5f72625fd38840d1283983561 /lisp/emacs-lisp
parent0a60bc107123321438fc1320ab34fcf588ec7128 (diff)
downloademacs-3ab6e069695d0dd5bb77133a89f858190ab8550a.tar.gz
emacs-3ab6e069695d0dd5bb77133a89f858190ab8550a.tar.bz2
emacs-3ab6e069695d0dd5bb77133a89f858190ab8550a.zip
Return more descriptive data from Fgarbage_collect.
Suggested by Stefan Monnier in http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00369.html. * src/alloc.c (bounded_number): New function. (total_buffers, total_vectors): New variable. (total_string_size): Rename to total_string_bytes, adjust users. (total_vector_size): Rename to total_vector_bytes, adjust users. (sweep_vectors): Account total_vectors and total_vector_bytes. (Fgarbage_collect): New return value. Adjust documentation. (gc_sweep): Account total_buffers. (Fmemory_free, Fmemory_use_counts): Use bounded_number. (VECTOR_SIZE): Remove. * src/data.c (Qfloat, Qvector, Qsymbol, Qstring, Qcons): Make global. (Qinterval, Qmisc): New symbols. (syms_of_data): Initialize them. * src/lisp.h (Qinterval, Qsymbol, Qstring, Qmisc, Qvector, Qfloat) (Qcons, Qbuffer): New declarations. * lisp/emacs-lisp/chart.el (chart-emacs-storage): Change to reflect new format of data returned by Fgarbage_collect.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/chart.el36
1 files changed, 19 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 74087014d69..5699d827d4f 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -676,23 +676,25 @@ SORT-PRED if desired."
"Chart the current storage requirements of Emacs."
(interactive)
(let* ((data (garbage-collect))
- (names '("strings/2" "vectors"
- "conses" "free cons"
- "syms" "free syms"
- "markers" "free mark"
- ;; "floats" "free flt"
- ))
- (nums (list (/ (nth 3 data) 2)
- (nth 4 data)
- (car (car data)) ; conses
- (cdr (car data))
- (car (nth 1 data)) ; syms
- (cdr (nth 1 data))
- (car (nth 2 data)) ; markers
- (cdr (nth 2 data))
- ;(car (nth 5 data)) ; floats are Emacs only
- ;(cdr (nth 5 data))
- )))
+ (cons-info (nth 0 data))
+ (symbol-info (nth 1 data))
+ (misc-info (nth 2 data))
+ (string-info (nth 3 data))
+ (vector-info (nth 4 data))
+ (float-info (nth 5 data))
+ (interval-info (nth 6 data))
+ (buffer-info (nth 7 data))
+ (names '("conses" "symbols" "miscs" "strings"
+ "vectors" "floats" "intervals" "buffers"))
+ (nums (list (* (nth 1 cons-info) (nth 2 cons-info))
+ (* (nth 1 symbol-info) (nth 2 symbol-info))
+ (* (nth 1 misc-info) (nth 2 misc-info))
+ (+ (* (nth 1 string-info) (nth 2 string-info))
+ (nth 3 string-info))
+ (nth 3 vector-info)
+ (* (nth 1 float-info) (nth 2 float-info))
+ (* (nth 1 interval-info) (nth 2 interval-info))
+ (* (nth 1 buffer-info) (nth 2 buffer-info)))))
;; Let's create the chart!
(chart-bar-quickie 'vertical "Emacs Runtime Storage Usage"
names "Storage Items"