Update of /cvsroot/sbcl/sbcl/src/pcl
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29232/src/pcl
Modified Files:
cache.lisp print-object.lisp
Log Message:
1.0.6.11: PRINT-OBJECT method adjusted for new caches
* "Oops" -- missed from the original cache commit.
Index: cache.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/pcl/cache.lisp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- cache.lisp 28 May 2007 18:52:26 -0000 1.51
+++ cache.lisp 1 Jun 2007 17:51:54 -0000 1.52
@@ -93,6 +93,17 @@
(defun power-of-two-ceiling (x)
(ash 1 (integer-length (1- x))))
+(defun cache-statistics (cache)
+ (let* ((vector (cache-vector cache))
+ (size (length vector))
+ (line-size (cache-line-size cache))
+ (total-lines (/ size line-size))
+ (free-lines (loop for i from 0 by line-size below size
+ unless (eq (svref vector i) '..empty..)
+ count t)))
+ (values (- total-lines free-lines) total-lines
+ (cache-depth cache) (cache-limit cache))))
+
;;; Don't allocate insanely huge caches.
(defconstant +cache-vector-max-length+ (expt 2 14))
Index: print-object.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/pcl/print-object.lisp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- print-object.lisp 13 Feb 2006 15:59:16 -0000 1.10
+++ print-object.lisp 1 Jun 2007 17:51:54 -0000 1.11
@@ -124,11 +124,17 @@
(defmethod print-object ((cache cache) stream)
(print-unreadable-object (cache stream :type t :identity t)
- (format stream
- "~W ~S ~W"
- (cache-nkeys cache)
- (cache-valuep cache)
- (cache-nlines cache))))
+ (multiple-value-bind (lines-used lines-total max-depth depth-limit)
+ (cache-statistics cache)
+ (format stream
+ "~D key, ~P~:[no value~;value~], ~D/~D lines, depth ~D/~D"
+ (cache-key-count cache)
+ (cache-key-count cache)
+ (cache-value cache)
+ lines-used
+ lines-total
+ max-depth
+ depth-limit))))
(defmethod print-object ((wrapper wrapper) stream)
(print-unreadable-object (wrapper stream :type t :identity t)
|