summaryrefslogtreecommitdiff
path: root/module/statprof.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2014-05-01 14:26:20 +0200
committerAndy Wingo <wingo@pobox.com>2014-05-01 14:26:20 +0200
commitde0233af177806ac96d535bb58f27875fb8c5375 (patch)
tree2df38f60a3a772f10d8b351dde2054892ebf5ca0 /module/statprof.scm
parentd7a67c3e918acd8ca46dc7792a8ca98b33cb94e8 (diff)
downloadguile-de0233af177806ac96d535bb58f27875fb8c5375.tar.gz
Fix inner and outer stack cuts to match on procedure code
* doc/ref/api-debug.texi (Stack Capture): Update make-stack docs. * libguile/programs.h: * libguile/programs.c (scm_program_address_range): New internal procedure. * libguile/stacks.c (narrow_stack): Interpret a pair of integers as an address range. If a cut is a procedure, attempt to resolve it to an address range. (scm_make_stack): Update docstring. * module/system/vm/program.scm (program-address-range): New exported procedure. * module/statprof.scm (statprof, gcprof): Use program-address-range to get the outer-cut, for efficiency.
Diffstat (limited to 'module/statprof.scm')
-rw-r--r--module/statprof.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/statprof.scm b/module/statprof.scm
index 76dfbea57..961f769e4 100644
--- a/module/statprof.scm
+++ b/module/statprof.scm
@@ -845,7 +845,8 @@ operation is somewhat expensive."
(let ((state (fresh-profiler-state #:count-calls? count-calls?
#:sampling-period
(inexact->exact (round (/ 1e6 hz)))
- #:outer-cut call-thunk)))
+ #:outer-cut
+ (program-address-range call-thunk))))
(parameterize ((profiler-state state))
(dynamic-wind
(lambda ()
@@ -905,7 +906,8 @@ Since GC does not occur very frequently, you may need to use the
@var{loop} parameter, to cause @var{thunk} to be called @var{loop}
times."
- (let ((state (fresh-profiler-state #:outer-cut call-thunk)))
+ (let ((state (fresh-profiler-state #:outer-cut
+ (program-address-range call-thunk))))
(parameterize ((profiler-state state))
(define (gc-callback)
(unless (inside-profiler? state)