[C++-sig] profiling python extension

John Reid j.reid at mail.cryst.bbk.ac.uk
Mon Mar 1 09:54:19 CET 2010

Alexey Akimov wrote:
> 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?

I use the profiler via explicit calls to ProfilerStart() and 
ProfilerStop() which I expose through boost.python and call in my python 
scripts. Then I can start and stop the profiler at will.

However from what I can see in the documentation what you've done looks 
correct as well. I suppose you could ask bjam to show you the link 
command to check it is using "-lprofiler".

More information about the Cplusplus-sig mailing list