[C++-sig] profiling C++ python extension

2008-11-21 Thread stephan nies
Hello,

I would like to profile an C++ python extension on Linux.

I am aware that oprofile and  valgrind exist.

But I was hoping to get it done with gprof.
Problem there is that for gprof to work
you would have to use -pg -g at every
compile and link step up to the main-function
in classic C++ programm.

Obviously thats different in python.
So do I have to recompile python?
Will that suffice? (I read about other
problems involving dlopen() being
used for imports)

Has anyone of you ever done profiling
a C or C++ extension with gprof?

Thanks,
Stephan
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] profiling C++ python extension

2008-11-21 Thread Alex Mohr

I am aware that oprofile and  valgrind exist.

Has anyone of you ever done profiling
a C or C++ extension with gprof?


Not me, but I have to say that valgrind's callgrind tool with 
kcachegrind to view the results has been perhaps the best profiling 
experience I've had on Linux.  I've had good success using these tools 
to profile C++ python extensions.


Alex

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] profiling C++ python extension

2008-11-21 Thread Mark Williams

Alex Mohr wrote:

I am aware that oprofile and  valgrind exist.

Has anyone of you ever done profiling
a C or C++ extension with gprof?


Not me, but I have to say that valgrind's callgrind tool with 
kcachegrind to view the results has been perhaps the best profiling 
experience I've had on Linux.  I've had good success using these tools 
to profile C++ python extensions.



I've had great results profiling Python extensions, too, but with 
Google's profiler: http://code.google.com/p/google-perftools/


Mark
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] profiling C++ python extension

2008-11-21 Thread stephan nies
Hi Mark,

just had a quick glance at the google-perftools documentation.

Could you provide a little more Detail in how you use it
with a python extension? Do you link against libprofiler.so
or do you use LD_PRELOAD ?

Do you do anything special other than that? Or do you
just start your python application?

Cheers,
Stephan

On Fri, Nov 21, 2008 at 7:20 PM, Mark Williams <[EMAIL PROTECTED]> wrote:
> Alex Mohr wrote:
>>>
>>> I am aware that oprofile and  valgrind exist.
>>>
>>> Has anyone of you ever done profiling
>>> a C or C++ extension with gprof?
>>
>> Not me, but I have to say that valgrind's callgrind tool with kcachegrind
>> to view the results has been perhaps the best profiling experience I've had
>> on Linux.  I've had good success using these tools to profile C++ python
>> extensions.
>
>
> I've had great results profiling Python extensions, too, but with Google's
> profiler: http://code.google.com/p/google-perftools/
>
> Mark
> ___
> Cplusplus-sig mailing list
> Cplusplus-sig@python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] profiling C++ python extension

2008-11-21 Thread Mark Williams

stephan nies wrote:

Hi Mark,

just had a quick glance at the google-perftools documentation.

Could you provide a little more Detail in how you use it
with a python extension? Do you link against libprofiler.so
or do you use LD_PRELOAD ?

Do you do anything special other than that? Or do you
just start your python application?
  
What I ended up doing was writing a small module (linked against 
libprofiler.so) containing bindings for the ProfilerStart/ProfilerStop 
functions. Then I could just import that module in Python and call 
start/stop around the sections I wanted to profile. After that I just 
ran "pprof" over the resulting file to create a PDF showing the call 
graph and timings.


Cheers,
Mark
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] where is the extension module?

2008-11-21 Thread josearios

yes, yes, the  --preserve-test-targets option saved my day!
thank you very much.


"David Abrahams" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Run bjam with "-n -a" and it will show you all the commands it
> executed to build and run the test. That includes the info you're
> looking for.  Oh, unless you pass --preserve-test-targets, the
> extension module is deleted when the test passes, so you might want to
> touch the .cpp file and try again.
>
> Sent from my iPhone
>
> On Nov 19, 2008, at 12:55 PM, "jrios" <[EMAIL PROTECTED]> wrote:
>
> > Hi everybody
> > I am just learning Boost.Python and so far I was able to install Boost
> > 1.37.0, got a free copy of Visual Studio 9 Express (thanks
> > Microsoft!) and
> > built all Boost libraries (a long wait of almost 3 hours).
> > Started the tutorial, compiled the extending example under
> > libs\python\example\quickstart, the test was successful.
> > But where is the extending module? I did an entire search under the
> > Boost
> > root and the closest thing I saw was a extending.pyd.rsp file. On
> > the python
> > console I typed >>import extending and I got "ImportError: No module
> > named
> > extending"
> > Please give me some hintthanks
> >
> >
> >
> > ___
> > Cplusplus-sig mailing list
> > Cplusplus-sig@python.org
> > http://mail.python.org/mailman/listinfo/cplusplus-sig
> >

___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig