(zilch magic): configurable CA build job count
Change-Id: I6a6a6964f157a33b35dae7245c344be7907c5221
This commit is contained in:
parent
dc7487b9e2
commit
db3b2316f0
2 changed files with 12 additions and 8 deletions
|
|
@ -38,12 +38,12 @@ to final build, or to specific Ninja targets.
|
||||||
; Set up the logger.
|
; Set up the logger.
|
||||||
(define (set-print-logs val) #f)
|
(define (set-print-logs val) #f)
|
||||||
(let ((prev-error-handler (current-exception-handler))) (current-exception-handler (lambda data (set-print-logs #t) (apply prev-error-handler data))))
|
(let ((prev-error-handler (current-exception-handler))) (current-exception-handler (lambda data (set-print-logs #t) (apply prev-error-handler data))))
|
||||||
(when (terminal-port? (current-error-port))
|
; (when (terminal-port? (current-error-port))
|
||||||
(let-values (((new-out new-err statusbar-set-print-logs logger) (statusbar-logger (current-output-port) (current-error-port) (assoc 'print-build-logs options))))
|
; (let-values (((new-out new-err statusbar-set-print-logs logger) (statusbar-logger (current-output-port) (current-error-port) (assoc 'print-build-logs options))))
|
||||||
(current-output-port new-out)
|
; (current-output-port new-out)
|
||||||
(current-error-port new-err)
|
; (current-error-port new-err)
|
||||||
(set! set-print-logs statusbar-set-print-logs)
|
; (set! set-print-logs statusbar-set-print-logs)
|
||||||
(*logger* logger)))
|
; (*logger* logger)))
|
||||||
|
|
||||||
;; Flags passed to the nix daemon:
|
;; Flags passed to the nix daemon:
|
||||||
(define max-jobs (if (assoc 'max-jobs options) (string->number (cdr (assoc 'max-jobs options))) (get-cpu-count)))
|
(define max-jobs (if (assoc 'max-jobs options) (string->number (cdr (assoc 'max-jobs options))) (get-cpu-count)))
|
||||||
|
|
@ -52,6 +52,8 @@ to final build, or to specific Ninja targets.
|
||||||
(write-string (string-append "Connected to Nix daemon, version " (daemon-link-daemon-version (*daemon*)) "\n") (current-error-port))
|
(write-string (string-append "Connected to Nix daemon, version " (daemon-link-daemon-version (*daemon*)) "\n") (current-error-port))
|
||||||
|
|
||||||
(daemon-wop-set-options (*daemon*) verbosity max-jobs #t)
|
(daemon-wop-set-options (*daemon*) verbosity max-jobs #t)
|
||||||
|
(ca-thread-count max-jobs)
|
||||||
|
|
||||||
(import
|
(import
|
||||||
(scheme base) (scheme file) (scheme read)
|
(scheme base) (scheme file) (scheme read)
|
||||||
(chicken format)
|
(chicken format)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
store-path-realised store-path-open
|
store-path-realised store-path-open
|
||||||
store-path-devirtualise
|
store-path-devirtualise
|
||||||
|
|
||||||
drv-resolve-ca
|
ca-thread-count drv-resolve-ca
|
||||||
|
|
||||||
zilch-magic-counters)
|
zilch-magic-counters)
|
||||||
|
|
||||||
|
|
@ -333,6 +333,8 @@
|
||||||
(define-record-printer (<pending-item> item out)
|
(define-record-printer (<pending-item> item out)
|
||||||
(fprintf out "#<pending-item ~A - awaiting ~S>" (derivation-path (pending-item-ca-drv item)) (pending-item-awaiting-count item)))
|
(fprintf out "#<pending-item ~A - awaiting ~S>" (derivation-path (pending-item-ca-drv item)) (pending-item-awaiting-count item)))
|
||||||
|
|
||||||
|
(define ca-thread-count (make-parameter 4))
|
||||||
|
|
||||||
(define (rewrite-ca-stack input-drv)
|
(define (rewrite-ca-stack input-drv)
|
||||||
; A mapping of CA derivation path to <pending-item>.
|
; A mapping of CA derivation path to <pending-item>.
|
||||||
(define ca-to-pending-map (mapping (make-default-comparator)))
|
(define ca-to-pending-map (mapping (make-default-comparator)))
|
||||||
|
|
@ -478,7 +480,7 @@
|
||||||
(builder quit conn))))))
|
(builder quit conn))))))
|
||||||
|
|
||||||
(define builder-threads '())
|
(define builder-threads '())
|
||||||
(do ((i 0 (+ i 1))) ((>= i 16) #f)
|
(do ((i 0 (+ i 1))) ((>= i (ca-thread-count)) #f)
|
||||||
(set! builder-threads
|
(set! builder-threads
|
||||||
(cons
|
(cons
|
||||||
(thread-start!
|
(thread-start!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue