[C++-sig] profiling python extension

Alexey Akimov alexey.akimov85 at gmail.com
Sun Feb 28 22:33:02 CET 2010


Thank you John,

I just installed the tool you suggested and tried to use it. However I do
not see any output. Could you give some more detailes of how the profiling
process with the google-profiler should look like?
What I do is:

1) bjam variant=profile toolset=gcc cxxflags=-fno-for-scope
linkflags=-lprofiler test_ext

2) env CPUPROFILE=/path/to/my/dir/out.prof python ./mypythonscript.py

This runs my python script which invokes the extension. However it does not
produce any output files (which i expect to be out.prof in my working
directory). What should I do in order to see the profiling information?


By the way, by this time I've tried other two tools suggested. Here are my
feelings:

1) oprofile - looks and works good. it is fast enough and produces much
useful information, there is a bunch of options to play with. The only
inconvenience is that I need to start and finish it only being a root. This
means I either have to switch back and forth oftenly or do all profiling
(and development as a root).
2) valgrind - also is pretty convenient tool and produces a lot of
information (the raw output loooks quite difficult to understand, but i
guess there is a play around options). It gives you many options of
profiling. The only bad thing - it is very slow.
3) google-profiling - is kind a promising for my purposes, but by this time
i still have not managed how to see the output information.

Best wishes
Alexey

2010/2/28 John Reid <j.reid at mail.cryst.bbk.ac.uk>

> Alexey Akimov wrote:
>
>> Does anyone know how one may profile a python extention?
>>
>
> I've used the google profiler on Linux successfully in the past. It is
> quite straightforward to set up inside an extension.
>
> http://goog-perftools.sourceforge.net/doc/cpu_profiler.html
>
> John.
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100228/487f10e6/attachment.html>


More information about the Cplusplus-sig mailing list