* "Oops" -- missed from the original cache commit.
(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))
(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)
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.6.10"
+"1.0.6.11"