Search code examples
pythoncocoamacospyobjc

What is the best way to sample/profile a PyObjC application?


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.


Solution

  • 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/