-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqldeb.lisp
31 lines (26 loc) · 1.01 KB
/
qldeb.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(in-package #:qldeb)
(defun main (args)
(declare (ignore args))
(setf lparallel:*kernel* (lparallel:make-kernel (* 2 (cpu-count))))
(let* ((channel (lparallel:make-channel))
(dist (ql-dist:find-dist "quicklisp"))
(releases (ql-dist:provided-releases dist)))
(submit-tasks channel #'download-and-package releases)
(wait-for-tasks channel (length releases))))
(defun submit-tasks (channel fn objects)
(dolist (object objects)
(lparallel:submit-task channel fn object)))
(defun wait-for-tasks (channel length)
(dotimes (i length)
(lparallel:receive-result channel)))
;;; Copy pasted from sb-cpu-affinity
(defun cpu-count ()
(let* ((key "processor")
(len (length key)))
(with-open-file (f "/proc/cpuinfo")
(loop for line = (read-line f nil nil)
while line
count (when (> (length line) len)
(string= key line :end2 len))))))
(defun log (priority text &rest args)
(syslog:log "qldeb" :local0 priority (apply #'format nil text args)))