SBCL has gc hooks you might also use too, though I don’t think it’ll give you the duration of the just-finished gc.
Variable: *after-gc-hooks* [sb-ext]
¶
You might be able to just increment a counter, and call (room) each time, and at least log the data (assocaited with the counter) for subsequent analysis.
You might read docs about some CL based games, like Khandria, where they talk about dealing with gc. (TL;DR, not a major problem). Sorry, I don’t have a link for you.
Note that you can also work to writing less consing-intensive code too (more preallocated data structures, efficient use of fixnums, the stack, and lisp-specific extensions that allow you to do more tricks with the stack or
malloc()'d
memory.