(use-modules (srfi srfi-1) (srfi srfi-14)) (define (total-cell-heap) (assoc-ref (gc-stats) 'cell-heap-size)) (define (get-yields) (list 0 0)) (setvbuf (current-output-port) _IOLBF) (format #t "### plot '-' using 1:($2/$3) with lines title \"total/alive\"~%") # plot 'out' using 1:($2/$3) with lines title "alive/total" (let loop ((iteration 0)) (if (> iteration 1000) #t (begin ; 100k cells, (let ((lst (list-tabulate 1000 (lambda (i) (char-set #\.) ;; double-cell (make-list 100))))) (if (and (= (modulo iteration 1000) 0) (> iteration 0)) ;; sporadic heap-intensive job ; 1M cells. (make-list 1000000))) (if (= 0 (modulo iteration 10)) (let* ((total (total-cell-heap)) (alive (assoc-ref (gc-stats) 'cells-allocated))) (format #t "~a ~a ~a~%" iteration alive total ))) (loop (1+ iteration)))))