views:

191

answers:

1

Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the Python interpreter. I would be helpful to see the corresponding Python symbol names. Is there some DTrace magic that can do that? Python's cProfile module can be useful for profiling individual subtrees of Python calls, but not so much for getting a picture of what's going on with the whole application in response to user events.

+2  A: 

The answer is "dtrace", but it won't work on sufficiently old macs.

http://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-1/

http://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-2/

wnoise
The above links are broken, but I found the same content here:http://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-1/andhttp://tech.marshallfamily.com.au/archives/python-dtrace-on-os-x-leopard-part-2/
Dan