Dust off stack sampler.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 6 Jan 2019 04:14:01 +0000 (04:14 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sat, 9 Feb 2019 16:59:10 +0000 (16:59 +0000)
Use of compiled-code-address? will be needed by the
riastrah-20181220-closentry{...} branch.

src/runtime/stack-sample.scm

index ebe350bbe1d9c11053712193a1310afc3ab07f42..834f4469fa918590352ec62f4353282be532747f 100644 (file)
@@ -78,9 +78,6 @@
 \f
 ;;;; Miscellaneous Kludgerosity
 
-(define (compiled-entry? object)
-  (object-type? (ucode-type compiled-entry) object))
-
 (define event-return-address 'uninitialized)
 
 (define (initialize-package!)
          (if (eq? stack-frame-type/compiled-return-address
                   (stack-frame/type stack-frame))
              (parameterize ((stack-sampling-return-address
-                            (stack-frame/return-address stack-frame)))
-              (thunk))
+                             (stack-frame/return-address stack-frame)))
+               (thunk))
              (thunk)))))))
 \f
 ;;;; Profile Data
           (else (find-subproblem stack-frame)))))
 
 (define (find-subproblem stack-frame)
-  (if (compiled-entry? (stack-frame/return-address stack-frame))
+  (if (compiled-code-address? (stack-frame/return-address stack-frame))
       stack-frame
       (find-next-subproblem stack-frame)))
 
 
 (define (intern-entry profile stack-frame)
   (let ((return-address (stack-frame/return-address stack-frame)))
-    (if (compiled-entry? return-address)
+    (if (compiled-code-address? return-address)
         (let ((return-address
                (if (compiled-closure? return-address)
                    (compiled-closure->entry return-address)
   (let ((entries (hash-table-values (profile.entries profile))))
     (define (sortem entry.count)
       (sort (remove (lambda (e) (zero? (entry.count e)))
-                   entries)
+                    entries)
             (lambda (a b) (< (entry.count a) (entry.count b)))))
     (let ((sampled (sortem entry.sampled-count))
           (waiting (sortem entry.waiting-count)))
 (define (profile-pp expression output-port)
   ;; Random parametrization.
   (parameterize ((param:printer-list-breadth-limit 5)
-                (param:printer-list-depth-limit 3)
-                (param:printer-string-length-limit 40)
-                (param:print-primitives-by-name? #t)
-                (param:pp-save-vertical-space? #t)
-                (param:pp-default-as-code? #t))
+                 (param:printer-list-depth-limit 3)
+                 (param:printer-string-length-limit 40)
+                 (param:print-primitives-by-name? #t)
+                 (param:pp-save-vertical-space? #t)
+                 (param:pp-default-as-code? #t))
     (pp expression output-port)))
\ No newline at end of file