;;; debugging evaluator is slower. This should
;;; have a more sensible default.
-(if (ly:get-option 'verbose)
+(if (or (ly:get-option 'verbose)
+ (ly:get-option 'trace-memory-frequencency))
(begin
(ly:set-option 'protected-scheme-parsing #f)
(debug-enable 'debug)
(define-module (scm memory-trace))
-(use-modules (ice-9 format))
(define-public (mtrace:start-trace freq)
(set! usecond-interval (inexact->exact (/ 1000000 freq)))
(call-with-new-thread start-install-tracepoint))
(set! busy-tracing #t)
(trap-disable 'traps)
(trap-disable 'enter-frame)
+
(set! trace-count (1+ trace-count))
(set! trace-points
(assoc 'total-cells-allocated (gc-stats))
(cons 'stack (extract-trace continuation))
(cons 'proc (arg-procedure args))
+ (cons 'time (tms:utime (times)))
)
trace-points))
(install-tracepoint)))
(define-public (mtrace:dump-results base)
- (define out (open-output-file (format #f "~a.graph" base)))
+ (define out-graph (open-output-file (format #f "~a.graph" base)))
(define stacks-out (open-output-file (format #f "~a.stacks" base)))
(define i 0)
- (define last-mem 0)
- (format out "# memory trace with ~a points\n" (length trace-points))
+ (define last-mem 0)
+
+ (format out-graph "# memory trace with ~a points\n" (length trace-points))
(for-each
(lambda (r)
(let*
((mem (cdr (assoc 'total-cells-allocated r)))
(proc (cdr (assoc 'proc r)))
- (stack (cdr (assoc 'stack r))))
+ (stack (cdr (assoc 'stack r)))
+ (time (cdr (assoc 'time r))))
- (format out "~a ~a\n" i mem)
+ (format out-graph "~a ~a\n" time mem)
(if stack
(begin
(format stacks-out "~15a - delta-mem: ~15a - ~a \n" i
trace))
-
-
-
-