<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body dir="ltr" bgcolor="#ffffff" text="#000000">
<p style="margin-bottom: 0cm; margin-top: 0pt;">rasmus wrote:<br>
</p>
<blockquote
 cite="mid1184113272.962640.41240@22g2000hsm.googlegroups.com"
 type="cite">
  <pre wrap="">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

  </pre>
</blockquote>
<br>
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: <a class="moz-txt-link-freetext" href="http://rogue.colorado.edu/pin/">http://rogue.colorado.edu/pin/</a>) 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).<br>
<br>
Hope this helps,<br>
Gal Diskin<br>
</body>
</html>