<div>For statprof to work with your code, you will have to rewrite your macros using Gambit's ##define-syntax.</div>
<div> </div>
<div>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.</div>

<div> </div>
<div>Here's a 'when' macro defined using ##define-syntax :</div>
<div> </div>
<div>(##define-syntax when<br>  (lambda (form-src)<br>    (let ((test (cadr (##source-code form-src)))<br>          (body (cddr (##source-code form-src))))<br>      (##sourcify<br>        `(if ,test<br>             (begin<br>
               ,@body)<br>           #f)<br>        form-src))))</div>
<div> </div>
<div>A partial list of primitives you will need :</div>
<div>
<ul>
<li>(##source? expr) : guess what it does :)</li>
<li>(##source-code source) : returns the sepxr that was sourcified by 'source'</li>
<li>(##desourcify source) : full recursive desourcification of 'source'</li>
<li>(##sourcify expr source) : creates a source object for 'expr' that has the same source info as 'source'</li></ul>
<div>  </div></div>
<div class="gmail_quote">On Thu, Nov 6, 2008 at 8:21 AM, David St-Hilaire <span dir="ltr"><<a href="mailto:sthilaid@iro.umontreal.ca">sthilaid@iro.umontreal.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi all!<br><br>I often use Guillaume Germain's profiler for gambit<br>(<a href="http://www.iro.umontreal.ca/~germaing/statprof.html" target="_blank">http://www.iro.umontreal.ca/~germaing/statprof.html</a>) and I would like to know<br>
if its possible to get a profiling result on the marco expanded code, and not<br>the source code.<br><br>I ask this because I wrote several macro which define multiple functions. It<br>seems that lots of the work is done within these functions but the profiler only<br>
tells me that it is my macro call who does all the work (but its in fact the<br>code generated by that macro). So having access to a profiling report of the<br>macro expanded code could be usefull :)<br><br>Thanks!<br><br>
David<br>_______________________________________________<br>Gambit-list mailing list<br><a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br><a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br>