1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

statprof and gcprof procedures use a fresh statprof state

* module/statprof.scm (statprof, gcprof): Create a fresh statprof
  state.
This commit is contained in:
Andy Wingo 2014-02-25 22:16:49 +01:00
parent 4b3d7a2b7c
commit fd5dfcce80

View file

@ -658,8 +658,8 @@ If @var{full-stacks?} is true, at each sample, statprof will store away the
whole call tree, for later analysis. Use @code{statprof-fetch-stacks} or
@code{statprof-fetch-call-tree} to retrieve the last-stored stacks."
(define state (ensure-profiler-state))
(let ((state (fresh-profiler-state)))
(parameterize ((profiler-state state))
(dynamic-wind
(lambda ()
(statprof-reset (inexact->exact (floor (/ 1 hz)))
@ -675,8 +675,7 @@ whole call tree, for later analysis. Use @code{statprof-fetch-stacks} or
(lp (1- i)))))
(lambda ()
(statprof-stop)
(statprof-display)
(set-procedure-data! state #f))))
(statprof-display))))))
(define-macro (with-statprof . args)
"Profiles the expressions in its body.
@ -732,7 +731,8 @@ If @var{full-stacks?} is true, at each sample, statprof will store away the
whole call tree, for later analysis. Use @code{statprof-fetch-stacks} or
@code{statprof-fetch-call-tree} to retrieve the last-stored stacks."
(define state (ensure-profiler-state))
(let ((state (fresh-profiler-state)))
(parameterize ((profiler-state state))
(define (reset)
(when (positive? (profile-level state))
@ -795,5 +795,4 @@ whole call tree, for later analysis. Use @code{statprof-fetch-stacks} or
(lp (1- i)))))
(lambda ()
(stop)
(statprof-display)
(set-procedure-data! state #f))))
(statprof-display))))))