Move the gc watcher to start earlier

This means it doesn't use the fibers sleep, don't know if this makes a
difference.
This commit is contained in:
Christopher Baines 2025-06-29 21:14:33 +02:00
parent ae6d7621d1
commit fc6f78ca9a
2 changed files with 31 additions and 25 deletions

View file

@ -130,30 +130,6 @@
(setrlimit 'nofile 4096 4096))
#:unwind? #t)
(call-with-new-thread
(lambda ()
(set-thread-name "gc watcher")
(add-hook!
after-gc-hook
(let ((last-gc-time-taken
(assq-ref (gc-stats) 'gc-time-taken)))
(lambda ()
(let* ((gc-time-taken
(assq-ref (gc-stats) 'gc-time-taken))
(time-since-last
(/ (- gc-time-taken
last-gc-time-taken)
internal-time-units-per-second)))
(when (> time-since-last 0.1)
(format (current-error-port)
"after gc (additional time taken: ~f)\n"
time-since-last))
(set! last-gc-time-taken
(assq-ref (gc-stats) 'gc-time-taken))))))
(while #t
(sleep 0.1))))
(let ((finished? (make-condition))
(request-scheduler #f))
(call-with-sigint