mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
statprof avoids mucking with VM trace levels when not counting calls
* module/statprof.scm (statprof-start, statprof-stop): Don't futz the vm trace level when we aren't counting calls. With this change, statprof now imposes no overhead on the measured program.
This commit is contained in:
parent
a234ab929c
commit
da169db26a
1 changed files with 5 additions and 5 deletions
|
@ -403,8 +403,8 @@ than @code{statprof-stop}, @code{#f} otherwise."
|
|||
(set-prev-sigprof-handler! state (car prev)))
|
||||
(reset-sigprof-timer (if (zero? rpt) (sampling-period state) rpt))
|
||||
(when (call-counts state)
|
||||
(add-hook! (vm-apply-hook) count-call))
|
||||
(set-vm-trace-level! (1+ (vm-trace-level)))
|
||||
(add-hook! (vm-apply-hook) count-call)
|
||||
(set-vm-trace-level! (1+ (vm-trace-level))))
|
||||
#t)))
|
||||
|
||||
;; Do not call this from statprof internal functions -- user only.
|
||||
|
@ -414,12 +414,12 @@ than @code{statprof-stop}, @code{#f} otherwise."
|
|||
;; signals here, but if I'm wrong, please let me know.
|
||||
(set-profile-level! state (- (profile-level state) 1))
|
||||
(when (zero? (profile-level state))
|
||||
(when (call-counts state)
|
||||
(set-vm-trace-level! (1- (vm-trace-level)))
|
||||
(remove-hook! (vm-apply-hook) count-call))
|
||||
(set-gc-time-taken! state
|
||||
(- (assq-ref (gc-stats) 'gc-time-taken)
|
||||
(gc-time-taken state)))
|
||||
(set-vm-trace-level! (1- (vm-trace-level)))
|
||||
(when (call-counts state)
|
||||
(remove-hook! (vm-apply-hook) count-call))
|
||||
;; I believe that we need to do this before getting the time
|
||||
;; (unless we want to make things even more complicated).
|
||||
(set-remaining-prof-time! state (reset-sigprof-timer 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue