rasmus wrote:
I have used gprof to profile stand alone C++ programs. I am also
aware of pure python profilers. However, is there a way to get
profile information on my C++ functions when they are compiled in a
shared library (python extension module) and called from python. From
what I can tell, gmon.out will not be generated unless the entire
executable (python interpreter) was compiled with -pg. Is my only
solution to recompile the python interpreter with -pg so that my
extension module (also compiled with -pg) produces a gmon.out?
Any suggestions or tips would be helpful.
Matt
This may not be the best solution but it will work without any
recompiles. Use the binary instrumentation tool PIN from Intel (you can
get it here: http://rogue.colorado.edu/pin/) as far as I understand the
license it's free for non-commercial use (if you're looking for
commercial use ask your legal department... :) ). Once you're using PIN
all you need to do is write a simple "pintool" (a profiler) that will
profile only your shared library and leave the rest of the code alone.
(there is a mailing list called pinheads in yahoo that is monitored by
the developers and a lot of example code in the released kits).
Hope this helps,
Gal Diskin
--
http://mail.python.org/mailman/listinfo/python-list