Profiling Python Apps on Mac?

David Cournapeau cournape at gmail.com
Thu Jan 29 01:11:26 EST 2009


On Thu, Jan 29, 2009 at 4:14 AM, RGK <blank at empty.blank> wrote:
> I'm writing a python app on a Mac (in Eclipse + PyDev w/ Python2.5 &
> wxPython under OSX 10.4)
>
> As I make program architecture decisions, it would be nice to be able to
> profile the choices.  Should I add that extra thread?  Is this big-assed xml
> object I just created horribly bloated or kind of ordinary.
>
> Is there anything out there I should look into to if I want to see how those
> things are affecting my app?   The closest I have is the widget iStat, but
> it's a very static low resolution view of what's really going on.

On Mac OS X, dtrace can sometimes be quite useful. The Apple-provided
python has the necessary 'probes'.

http://blogs.sun.com/binujp/entry/dtrace_provider_for_python

There are some useful scripts in the dtrace toolkit geared toward python:

http://www.brendangregg.com/dtrace.html#DTraceToolkit

If you want dtrace support for a bare python (built from sources), I
made a quick patch, "documented" here:

http://cournape.wordpress.com/?s=dtrace

I don't know if it works for 2.6 (I doubt it would work out of the box
- I don't claim any understanding of dtrace internals, I just applied
the apple patches, removing all the apple specifics I did not care
about).

David



More information about the Python-list mailing list