On Jul 15, 2009, at 10:03 PM, Stefan Behnel wrote:

> [forwarding to the list]
>
> Date: Thu, 16 Jul 2009 00:27:27 -0400
> From: Chuck Blake <[email protected]>
>
> Kurt Smith wrote:
>> Have the profiling transform inject 'marker' lines at the necessary
>> level of detail (for function-level or line-by-line level profiling).
>> This would come fairly early in the pipeline before mangling
>> transforms take place.  The markers would contain all the necessary
>> info -- the source line text, location, etc.
>>
>> At code generation phase, these marker lines would be turned into
>> profiling code (macros as you mention, or something else if too
>> complex).
>
> Your proposal seems more about the compile-time instrumentation style
> of profiling by exact counting.
>
> If you are willing to accept or begin with a statistical profile as
> guidance, I have a solution that works, at least under Linux:
>     http://pdos.csail.mit.edu/~cblake/pct/index.html
>
> Basically, you just download and install pct (make && sudo make  
> install)
> and compile your Cython modules with --line-directives.  Then you  
> can go
>     PCT_FMT=line% profile python myscript.py
> to get a line-by-line report.
>
> If you don't do the --line-directives, the line numbers will refer to
> the generated .c files.
>
> You can also get symbol-level profiling and a variety of other  
> reports.

One issue that's hard to solve this way is that if you're going back  
and forth between Cython and Python, the Python interpreter calls add  
a lot of noise to the output.

> Some ambitious soul could perhaps extend the HTML annotation of
> Pythonic-ness to include CPU slowness to really highlight areas
> where careful attention might pay off a lot.

That would be cool.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to