Changeset 12710


Ignore:
Timestamp:
Aug 28, 2009, 10:18:59 AM (10 years ago)
Author:
gb
Message:

Make HEAP-UTILIZATION track (and REPORT-HEAP-UTILIZATION report) the physical
size of uvectors (including headers and alignment overhead) as well as their
logical sizes.
Summarize total logical, physical sizes in REPORT-HEAP-UTILIZATION.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/misc.lisp

    r12112 r12710  
    895895         (nvectors (make-array 256))
    896896         (vector-sizes (make-array 256))
     897         (vector-physical-sizes (make-array 256))
    897898         (array-size-function (arch::target-array-data-size-function
    898899                               (backend-target-arch *host-backend*))))
    899900    (declare (type (simple-vector 256) nvectors vector-sizes)
    900              (dynamic-extent nvectors vector-sizes))
     901             (dynamic-extent nvectors vector-sizes vector-physical-sizes))
    901902    (when gc-first (gc))
    902903    (%map-areas (lambda (thing)
    903904                  (if (listp thing)
    904905                    (incf nconses)
    905                     (let* ((typecode (typecode thing)))
     906                    (let* ((typecode (typecode thing))
     907                           (logsize (funcall array-size-function typecode (uvsize thing))))
    906908                      (incf (aref nvectors typecode))
    907                       (incf (aref vector-sizes typecode)
    908                             (funcall array-size-function typecode (uvsize thing)))))))
    909     (report-heap-utilization stream nconses nvectors vector-sizes)
     909                      (incf (aref vector-sizes typecode) logsize)
     910                      (incf (aref vector-physical-sizes typecode)
     911                            (logandc2 (+ logsize
     912                                         #+64-bit-target (+ 8 15)
     913                                         #+32-bit-target (+ 4 7))
     914                                      #+64-bit-target 15
     915                                      #+32-bit-target 7))))))
     916                                         
     917    (report-heap-utilization stream nconses nvectors vector-sizes vector-physical-sizes)
    910918    (values)))
    911919
     
    954962 
    955963   
    956 (defun report-heap-utilization (out nconses nvectors vector-sizes)
    957   (format out "~&Object type~42tCount~50tTotal Size in Bytes")
    958   (format out "~&CONS~36t~12d~48t~16d" nconses (* nconses target::cons.size))
    959   (dotimes (i (length nvectors))
    960     (let* ((count (aref nvectors i))
    961            (sizes (aref vector-sizes i)))
    962       (unless (zerop count)
    963         (format out "~&~a~36t~12d~48t~16d" (aref *heap-utilization-vector-type-names* i)  count sizes)))))
     964(defun report-heap-utilization (out nconses nvectors vector-sizes vector-physical-sizes)
     965  (let* ((total-cons-size  (* nconses target::cons.size))
     966         (total-vector-size 0)
     967         (total-physical-vector-size 0))
     968    (format out "~&Object type~42tCount~50tTotal Size in Bytes~72tTotal Size")
     969    (format out "~&CONS~36t~12d~48t~16d~16d" nconses total-cons-size total-cons-size)
     970    (dotimes (i (length nvectors))
     971      (let* ((count (aref nvectors i))
     972             (sizes (aref vector-sizes i))
     973             (psizes (aref vector-physical-sizes i)))
     974        (unless (zerop count)
     975          (incf total-vector-size sizes)
     976          (incf total-physical-vector-size psizes)
     977          (format out "~&~a~36t~12d~48t~16d~16d" (aref *heap-utilization-vector-type-names* i)  count sizes psizes))))
     978    (format out "~&   Total sizes: ~49t~16d~16d" (+ total-cons-size total-vector-size) (+ total-cons-size total-physical-vector-size))))
    964979                           
    965980;; The number of words to allocate for static conses when the user requests
Note: See TracChangeset for help on using the changeset viewer.