aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/coordinator.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm
index 2abec78..a0c5361 100644
--- a/guix-build-coordinator/coordinator.scm
+++ b/guix-build-coordinator/coordinator.scm
@@ -496,6 +496,31 @@
(lambda (scheduler port)
(display "#<scheduler>" port)))
+ (call-with-new-thread
+ (lambda ()
+ (set-thread-name
+ (string-append "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))))
+
(when update-datastore?
(datastore-update (build-coordinator-datastore build-coordinator)))