[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: resolving anonymous procedures in statprof
From: |
Ludovic Courtès |
Subject: |
Re: resolving anonymous procedures in statprof |
Date: |
Thu, 05 Mar 2020 22:32:04 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hi Christopher,
Christopher Howard <address@hidden> skribis:
> Hi, Guile's statprof utility is very helpful, but a lot of my output
> lines point to anonymous procedures like "anon #x1db7d38". Is there a
> way to figure out which specific lambdas those are referring to? In
> principle it seems like I should be able to figure that out by running
> the dissembler (,x) on the code I am profiling with statprof, but the
> addresses given by the dissassembler do not match the ones given by
> statprof.
I had the very same question not long ago actually. :-)
I fiddled a bit to see how it could be that Guile couldn’t figure out
debugging info for a code snippet, to no avail (on Guile 3). For
instance, the attached snippet didn’t seem to have any effect.
Any ideas, Andy?
Thanks,
Ludo’.
diff --git a/module/statprof.scm b/module/statprof.scm
index 33eac4468..dc057eb20 100644
--- a/module/statprof.scm
+++ b/module/statprof.scm
@@ -388,8 +388,13 @@ always collects full stacks.)"
data))))
(define (addr->printable addr pdi)
- (or (and=> (and=> pdi program-debug-info-name) symbol->string)
- (string-append "anon #x" (number->string addr 16))))
+ (or (and=> pdi program-debug-info-name)
+ (let ((base (string-append "anon #x"
+ (number->string addr 16)))
+ (loc (find-source-for-addr addr)))
+ (if loc
+ (string-append base ":" (source->string loc))
+ base))))
(define (inc-call-data-cum-sample-count! cd)
(set-call-data-cum-sample-count! cd (1+ (call-data-cum-sample-count cd))))