With some help from Marc Feeley I have implemented a simple statistical profiler for Gambit. It is available at the following address: http://www.iro.umontreal.ca/~germaing/statprof.html
Here's an output example: http://www.iro.umontreal.ca/~germaing/ring.scm.html
It's not perfect and was put together somewhat quickly, but I think it can be useful.
Guillaume
Afficher les réponses par date
On Jan 23, 2005, at 9:52 PM, Guillaume Germain wrote:
With some help from Marc Feeley I have implemented a simple statistical profiler for Gambit. It is available at the following address: http://www.iro.umontreal.ca/~germaing/statprof.html
Here's an output example: http://www.iro.umontreal.ca/~germaing/ring.scm.html
It's not perfect and was put together somewhat quickly, but I think it can be useful.
I'm trying to use your profiler as a test coverage tool; is there any way to make the intervals between when samples are taken are made very small? I'd rather do that than try to get long enough run times so that each basic block shows up in the report as executed at least once.
Brad
On Apr 26, 2005, at 10:25 PM, Bradley Lucier wrote:
I'm trying to use your profiler as a test coverage tool; is there any way to make the intervals between when samples are taken are made very small?
Scratch that thought; instead, would it be easy to write a coverage tool that is a modified version of your profiling tool?
Brad
On Apr 27, 2005, at 1:10 AM, Bradley Lucier wrote:
On Apr 26, 2005, at 10:25 PM, Bradley Lucier wrote:
I'm trying to use your profiler as a test coverage tool; is there any way to make the intervals between when samples are taken are made very small?
Scratch that thought; instead, would it be easy to write a coverage tool that is a modified version of your profiling tool?
Brad
Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
Something like this might be a good start for such a tool.
Marc
; ======================================================================== ======
; File: "coverage.scm", Time-stamp: <2005-04-27 12:12:52 feeley>
; Copyright (C) 2005 by Marc Feeley, All Rights Reserved.
; ======================================================================== ======
; This is a simple test coverage system for Gambit 4.0 that uses the ; interpreter's single stepping infrastructure. The test coverage can ; only be done on interpreted code. However, the test coverage system ; (this file) can either be compiled or not, but if it is not compiled ; the program's execution will be much slower. When the test coverage ; system is compiled the program's execution is roughly 4 times slower ; than normal. When the test coverage system is interpreted the ; program's execution is roughly 20 times slower than normal. ; ; Here's a sample use: ; ; % gsi coverage.scm - ; > (coverage-on) ; > (if #f (+ 1 2 3) 4) ; (console)@2.5 ; (console)@2.18 ; 4 ; > (coverage-off) ; (console)@3.2 ; (console)@3.1 ; > (if #f (+ 1 2 3) 4) ; 4
; ======================================================================== ======
(define-macro (coverage-system-setup)
(define coverage-system-code '(let ()
(define (step-handler leapable? $code rte execute-body . other) (hit (##code-locat $code)) (##apply execute-body (##cons $code (##cons rte other))))
(define (hit locat) (if locat (begin ; the statistics could be tallied and displayed in a ; more user-friendly way than just dumping them to stderr (##display-locat locat #t ##stderr-port) (##newline ##stderr-port))))
(let ((new-stepper (##vector (##vector step-handler step-handler step-handler step-handler step-handler step-handler step-handler) #f #f #f #f #f #f #f))) (set! ##main-stepper new-stepper))))
`(if (##interp-procedure? (lambda () 0)) ; compiled or interpreted?
(begin (set! ##main-stepper (##no-stepper)) ; don't step coverage system! (##eval ',coverage-system-code))
(begin ,coverage-system-code)))
(define (coverage-on) (##step-on))
(define (coverage-off) (##step-off))
(coverage-system-setup)
; ======================================================================== ======