Add the gc watcher from the build coordinator
This commit is contained in:
parent
d2b3e75198
commit
26d2b6377b
1 changed files with 25 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-71)
|
#:use-module (srfi srfi-71)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (ice-9 format)
|
||||||
#:use-module (ice-9 threads)
|
#:use-module (ice-9 threads)
|
||||||
#:use-module (web http)
|
#:use-module (web http)
|
||||||
#:use-module (web request)
|
#:use-module (web request)
|
||||||
|
|
@ -127,6 +128,30 @@
|
||||||
(setrlimit 'nofile 4096 4096))
|
(setrlimit 'nofile 4096 4096))
|
||||||
#:unwind? #t)
|
#: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))
|
(let ((finished? (make-condition))
|
||||||
(request-scheduler #f))
|
(request-scheduler #f))
|
||||||
(call-with-sigint
|
(call-with-sigint
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue