1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-30 15:00:21 +02:00

minor statprof tweaks

* module/statprof.scm (statprof-reset): Make full-stacks? into an
  optional arg instead of doing the rest arg dance.
  (statprof-display): Format gc-time-taken appropriately.
This commit is contained in:
Andy Wingo 2011-05-05 09:59:59 +02:00
parent e6e286bb58
commit e640b44046

View file

@ -379,8 +379,8 @@ than @code{statprof-stop}, @code{#f} otherwise."
(accumulate-time (get-internal-run-time)) (accumulate-time (get-internal-run-time))
(set! last-start-time #f)))) (set! last-start-time #f))))
(define (statprof-reset sample-seconds sample-microseconds count-calls? (define* (statprof-reset sample-seconds sample-microseconds count-calls?
. full-stacks?) #:optional full-stacks?)
"Reset the statprof sampler interval to @var{sample-seconds} and "Reset the statprof sampler interval to @var{sample-seconds} and
@var{sample-microseconds}. If @var{count-calls?} is true, arrange to @var{sample-microseconds}. If @var{count-calls?} is true, arrange to
instrument procedure calls as well as collecting statistical profiling instrument procedure calls as well as collecting statistical profiling
@ -397,7 +397,7 @@ Enables traps and debugging as necessary."
(set! sampling-frequency (cons sample-seconds sample-microseconds)) (set! sampling-frequency (cons sample-seconds sample-microseconds))
(set! remaining-prof-time #f) (set! remaining-prof-time #f)
(set! procedure-data (make-hash-table 131)) (set! procedure-data (make-hash-table 131))
(set! record-full-stacks? (and (pair? full-stacks?) (car full-stacks?))) (set! record-full-stacks? full-stacks?)
(set! stacks '()) (set! stacks '())
(sigaction SIGPROF profile-signal-handler) (sigaction SIGPROF profile-signal-handler)
#t) #t)
@ -531,7 +531,7 @@ optional @var{port} argument is passed, uses the current output port."
(simple-format #t "Sample count: ~A\n" (statprof-sample-count)) (simple-format #t "Sample count: ~A\n" (statprof-sample-count))
(simple-format #t "Total time: ~A seconds (~A seconds in GC)\n" (simple-format #t "Total time: ~A seconds (~A seconds in GC)\n"
(statprof-accumulated-time) (statprof-accumulated-time)
(/ gc-time-taken internal-time-units-per-second)))))) (/ gc-time-taken 1.0 internal-time-units-per-second))))))
(define (statprof-display-anomolies) (define (statprof-display-anomolies)
"A sanity check that attempts to detect anomolies in statprof's "A sanity check that attempts to detect anomolies in statprof's