Re: Safe GC timing

"Tim Bradshaw (as tfb at tfeb dot org)" <[email protected]> Tue, 23 Jun 2026 13:05:39 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
A thing that it would be nice if LW had would be a (gc-timing-p) function which would tell you if GC timing was enabled or not.  This would allow things which want to use timing to compose safely with other things which do: check if timing is enabled, if it is don't reset it or disable it.  At the moment my macro uses a secret special variable to know if it's being used recursively.

This is a very small and unimportant thing!

--tim

> On 18 Jun 2026, at 11:21, Tim Bradshaw (as tfb at tfeb dot org) <[email protected]> wrote:
> 
> I'm writing a macro to compute GC times (in several implementations, hence I'm only returning total time).
> 
> The guts of it for LW looks like
> 
> (let ((reset nil))
>  (unwind-protect
>      (progn
>        (enable-gc-timing)
>        (multiple-value-prog1
>            (values (funcall f) (getf (get-gc-timing :reset t) ':total) t)
>          (setf reset t)))
>    (unless reset
>      (get-gc-timing :reset t))))
> 
> Is this a safe approach?  It's obviously not going to compose with anything else which wants to time the GC.
> 
> --tim
> 
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> [email protected]
> http://www.lispworks.com/support/lisp-hug.html


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html