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:
parent
ae6d7621d1
commit
fc6f78ca9a
2 changed files with 31 additions and 25 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -26,12 +26,14 @@
|
|||
(use-modules (srfi srfi-1)
|
||||
(srfi srfi-37)
|
||||
(ice-9 match)
|
||||
(ice-9 format)
|
||||
(ice-9 atomic)
|
||||
(ice-9 threads)
|
||||
(ice-9 textual-ports)
|
||||
(system repl server)
|
||||
(system repl repl)
|
||||
(gcrypt pk-crypto)
|
||||
((knots thread-pool) #:select (set-thread-name))
|
||||
(guix pki)
|
||||
(guix-data-service utils)
|
||||
(guix-data-service config)
|
||||
|
|
@ -225,7 +227,35 @@
|
|||
"poll-startup"
|
||||
all-git-repositories))
|
||||
|
||||
(atomic-box-set! startup-completed #t)))))
|
||||
(atomic-box-set! startup-completed #t)))
|
||||
|
||||
(set-thread-name "gc watcher")
|
||||
|
||||
(add-hook!
|
||||
after-gc-hook
|
||||
(let ((last-gc-time-taken
|
||||
(assq-ref (gc-stats) 'gc-time-taken)))
|
||||
(lambda ()
|
||||
(let* ((stats
|
||||
(gc-stats))
|
||||
(gc-time-taken
|
||||
(assq-ref 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, times: ~d, heap-allocated-since-gc: ~d, heap size: ~d, heap free: ~d)\n"
|
||||
time-since-last
|
||||
(assq-ref stats 'gc-times)
|
||||
(assq-ref stats 'heap-allocated-since-gc)
|
||||
(assq-ref stats 'heap-size)
|
||||
(assq-ref stats 'heap-free-size)))
|
||||
(set! last-gc-time-taken
|
||||
(assq-ref (gc-stats) 'gc-time-taken))))))
|
||||
(while #t
|
||||
(usleep 100000))))
|
||||
|
||||
;; Provide some visual space between the startup output and the
|
||||
;; server starting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue