[gambit-list] Profiler still up to date?

David St-Hilaire sthilaid at iro.umontreal.ca
Fri Feb 29 14:10:21 EST 2008


Hello!

I'm currently trying to use Guillaume Germain's profiler 
(http://www.iro.umontreal.ca/~germaing/statprof.html) to well, em, profile my 
program ;). But I am encoutering severall problems... The exemple that comes 
with Guillaume's profile works just fine on my machine, but when I try to use it 
with my own code, it doesn't work...

I have something like:

include "statprof.scm")

(profile-start!)
(load "opengl")
(load "glu")
(load "glut")
(load "Question2")
(load "Question2-ui")
(profile-stop!)

(write-profile-report "profile-report")

where the main execution occurs in Question2-ui. When I compile all this, i.e. 
compiles opengl, glu, glut, Question2 and Question2-ui to .o1 files and then 
compile my profile.scm file to c -> native code, well the program runs fine, but 
when I stop it, I get:

*** ERROR IN write-profile-report -- Wrong number of arguments passed to procedure
(max)

With a little investigation, I found out that statprof's *bucket* variable is 
still empty when the profiling has ended... :(

Guillaume's code that should fill the *buckets* looks like:

(define (profile-heartbeat!)
   (##continuation-capture
    (lambda (cont)
      (##thread-heartbeat!)
      (let ((id (identify-continuation cont)))
        (pp id)
        (if (not (eq? id 'unknown))
            (let ((bucket (assoc (car id) *buckets*)))
              (set! *total* (+ *total* 1))
              (if (not bucket)
                  (begin
                    (set! *buckets* (cons
                                     (cons (car id)
                                           ;; fixme: arbitrary hard limit
                                           ;; on the length of source
                                           ;; files
                                           (make-vector 5000 0))
                                     *buckets*))
                    (set! bucket (car *buckets*))))

              (vector-set! (cdr bucket)
                           (cadr id)
                           (+ (vector-ref (cdr bucket)
                                          (cadr id))
                              1))))))))
As you can see, I've added a (pp id) to see what happens, and I only get some 
unknown printed in the console... So how come code doesn't get recognized in the 
profiler??

Thank you! ^_^

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20080229/50427f02/attachment.sig>


More information about the Gambit-list mailing list