For statprof to work with your code, you will have to rewrite your macros using Gambit's ##define-syntax.
 
When you use define-macro, Gambit strips all source information before passing the sexpr to expand to your macro. With ##define-syntax, you will receive a source object containing source positioning information for every sexpr in the form to expand. You can then insert those source objects into the expansion of your macro. Doing that, every Gambit tool that needs source information like statprof will now work with your macros.
 
Here's a 'when' macro defined using ##define-syntax :
 
(##define-syntax when
  (lambda (form-src)
    (let ((test (cadr (##source-code form-src)))
          (body (cddr (##source-code form-src))))
      (##sourcify
        `(if ,test
             (begin
               ,@body)
           #f)
        form-src))))
 
A partial list of primitives you will need :
  
On Thu, Nov 6, 2008 at 8:21 AM, David St-Hilaire <sthilaid@iro.umontreal.ca> wrote:
Hi all!

I often use Guillaume Germain's profiler for gambit
(http://www.iro.umontreal.ca/~germaing/statprof.html) and I would like to know
if its possible to get a profiling result on the marco expanded code, and not
the source code.

I ask this because I wrote several macro which define multiple functions. It
seems that lots of the work is done within these functions but the profiler only
tells me that it is my macro call who does all the work (but its in fact the
code generated by that macro). So having access to a profiling report of the
macro expanded code could be usefull :)

Thanks!

David
_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list