minor statprof tweaks
authorAndy Wingo <wingo@pobox.com>
Thu, 5 May 2011 07:59:59 +0000 (09:59 +0200)
committerAndy Wingo <wingo@pobox.com>
Thu, 5 May 2011 09:43:12 +0000 (11:43 +0200)
* 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.

module/statprof.scm

index da6f3f1..9455715 100644 (file)
@@ -379,8 +379,8 @@ than @code{statprof-stop}, @code{#f} otherwise."
         (accumulate-time (get-internal-run-time))
         (set! last-start-time #f))))
 
-(define (statprof-reset sample-seconds sample-microseconds count-calls?
-                        . full-stacks?)
+(define* (statprof-reset sample-seconds sample-microseconds count-calls?
+                         #:optional full-stacks?)
   "Reset the statprof sampler interval to @var{sample-seconds} and
 @var{sample-microseconds}. If @var{count-calls?} is true, arrange to
 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! remaining-prof-time #f)
   (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 '())
   (sigaction SIGPROF profile-signal-handler)
   #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 "Total time: ~A seconds (~A seconds in GC)\n"
                      (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)
   "A sanity check that attempts to detect anomolies in statprof's