aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-11-08 19:02:29 +0000
committerChristopher Baines <mail@cbaines.net>2024-11-08 22:34:28 +0000
commite7ada1bada71d4abd9701e74b1455b8948ad68cf (patch)
tree242b41806af031748afe9768e8c37584658b3b92
parentebeb4212ff279c10f601c98726c479b0a03a8469 (diff)
downloaddata-service-e7ada1bada71d4abd9701e74b1455b8948ad68cf.tar
data-service-e7ada1bada71d4abd9701e74b1455b8948ad68cf.tar.gz
Allow using the heap profiler in the inferior
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index d3261a5..3b2bda0 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -1714,6 +1714,31 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
(inferior-eval '(when (defined? '%graft?) (%graft? #f)) inf)
+ ;; Load the heap-profiler
+ (for-each
+ (lambda (exp)
+ (inferior-eval exp inf))
+ (call-with-input-file
+ (%search-load-path "guix-data-service/heap-profiler.scm")
+ (lambda (port)
+ (let loop ((result '()))
+ (let ((exp (read port)))
+ (if (eof-object? exp)
+ (reverse! result)
+ (loop (cons (if (eq? (car exp) 'define-module)
+ `(use-modules
+ ,@(let loop ((lst (cddr exp))
+ (result '()))
+ (match lst
+ ('() result)
+ (('#:use-module mod rest ...)
+ (loop rest
+ (cons mod result)))
+ (rest
+ (loop (cdr lst) result)))))
+ exp)
+ result))))))))
+
;; TODO Have Guix make this easier
((@@ (guix inferior) ensure-store-bridge!) inf)
(non-blocking-port ((@@ (guix inferior) inferior-bridge-socket) inf))