X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fgc.lisp;h=c3a59988bf0061313f41d46c96c4db13f7cf6f2e;hb=3bd7a97d1b11a2b0aee086ef211cae807f3dfc35;hp=79e70dffd79bf7e78f70f0b4c895d555a650fdd2;hpb=6879a37a9e6cceeab810636c5ef4a4da1444e275;p=sbcl.git diff --git a/src/code/gc.lisp b/src/code/gc.lisp index 79e70df..c3a5998 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -23,20 +23,24 @@ (defun ,lisp-fun () (sb!alien:extern-alien ,c-var-name (sb!alien:unsigned 32)))))) -#!+(or cgc gencgc) (progn -#!-sb-fluid (declaim (inline dynamic-usage)) -(def-c-var-frob dynamic-usage "bytes_allocated")) - +#!-gencgc +(progn + ;; This is called once per PROFILEd function call, so it's worth a + ;; little possible space cost to reduce its time cost. + #!-sb-fluid + (declaim (inline current-dynamic-space-start)) + (def-c-var-frob current-dynamic-space-start "current_dynamic_space")) + +#!-sb-fluid +(declaim (inline dynamic-usage)) ; to reduce PROFILEd call overhead +#!+(or cgc gencgc) +(def-c-var-frob dynamic-usage "bytes_allocated") #!-(or cgc gencgc) (defun dynamic-usage () (the (unsigned-byte 32) (- (sb!sys:sap-int (sb!c::dynamic-space-free-pointer)) (current-dynamic-space-start)))) -#!-gencgc (progn -#!-sb-fluid (declaim (inline current-dynamic-space-start)) -(def-c-var-frob current-dynamic-space-start "current_dynamic_space")) - (defun static-space-usage () (- (* sb!vm:*static-space-free-pointer* sb!vm:word-bytes) sb!vm:static-space-start)) @@ -191,8 +195,9 @@ and submit it as a patch." (defun default-gc-notify-before (notify-stream bytes-in-use) (declare (type stream notify-stream)) (format notify-stream - "~&; GC is beginning with ~:D bytes in use.~%" - bytes-in-use) + "~&; GC is beginning with ~:D bytes in use at internal runtime ~:D.~%" + bytes-in-use + (get-internal-run-time)) (finish-output notify-stream)) (defparameter *gc-notify-before* #'default-gc-notify-before #!+sb-doc @@ -207,11 +212,11 @@ and submit it as a patch." new-trigger) (declare (type stream notify-stream)) (format notify-stream - "~&; GC has finished with ~:D bytes in use (~:D bytes freed).~%" + "~&; GC has finished with ~:D bytes in use (~:D bytes freed)~@ + ; at internal runtime ~:D. The new GC trigger is ~:D bytes.~%" bytes-retained - bytes-freed) - (format notify-stream - "~&; The new GC trigger is ~:D bytes.~%" + bytes-freed + (get-internal-run-time) new-trigger) (finish-output notify-stream)) (defparameter *gc-notify-after* #'default-gc-notify-after @@ -227,7 +232,6 @@ has finished GC'ing.") (sb!alien:def-alien-routine collect-garbage sb!c-call:int #!+gencgc (last-gen sb!c-call:int)) - (sb!alien:def-alien-routine set-auto-gc-trigger sb!c-call:void (dynamic-usage sb!c-call:unsigned-long))