Re: Profiling python on OSX?
You can use valgrind and attach it to python (in which you recompile python for it...) On Mon, Oct 12, 2009 at 9:51 PM, nitroamos nitroa...@gmail.com wrote: Hello -- I'm a python noob, so I'm trying to figure out how to get access to the same data I'm used to from gprof, if possible. I was able to get cPython/Stats to work just fine... but I'm disappointed with the lack of detail in the output... Is there a better way? For example, OSX has the nice Sampler program (which I guess is now a part of Instruments)... is there a way I can use this to study my python scripts without all the python interpreter noise? Or some other OSX tool? And beyond this, is there a way to get the gprof data from my C++ extensions without recompiling python? I'm a bit uncomfortable recompiling python... I could do it, but seems like it's too much effort for what I'm trying to accomplish at the moment... thanks! Amos. -- http://mail.python.org/mailman/listinfo/python-list -- http://www.goldwatches.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python Apps on Mac?
On Jan 28, 2009, at 2:14 PM, RGK 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. Is there any reason that this wouldn't work? http://docs.python.org/library/hotshot.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python Apps on Mac?
Philip Semanchuk wrote: Is there any reason that this wouldn't work? http://docs.python.org/library/hotshot.html It suggests that it doesn't work well with threads, but as I didn't know about any options, it's a step forward. Thanks for the pointer. :) R. -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python Apps on Mac?
RGK bl...@empty.blank wrote: 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. python -m profile yourscript.py see http://docs.python.org/library/profile.html -- Pierre-Alain Dorange MicroWar 2.0 : tuez des PC http://microwar.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python Apps on Mac?
On Thu, Jan 29, 2009 at 4:14 AM, RGK bl...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python Apps on Mac?
On 2009-01-28 13:14, RGK 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. I have a script kernprof.py which provides a few conveniences over the builtin cProfile module. One of its modes of operation is to inject a decorator into the __builtins__. It will enable the profiler on entry to the method and disable it on exit. This lets you localize your profile results to just the part of your code that you are interested in. I found this especially useful in GUI apps which require user interaction to trigger the part of the code you are actually interesting in profiling. You don't want the interesting parts of your profile to be obscured by the GUI event loop waiting for your input. You can get it as part of my line_profiler package (which you may also be interested in; cProfile profiles function calls, line_profiler profiles individual lines). http://pypi.python.org/pypi/line_profiler You can view the profile results interactively with python -m pstats my_script.py.prof, RunSnakeRun, or pyprof2calltree if you manage to install kcachegrind on your system: http://www.vrplumber.com/programming/runsnakerun/ http://pypi.python.org/pypi/pyprof2calltree/1.1.0 I don't recommend using hotshot because it is deprecated and slow to postprocess the data dumps. Also, I don't recommend using the plain profile module because it slows down your program rather more than cProfile. See the Python documentation for an overview of these modules: http://docs.python.org/library/profile -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python
[EMAIL PROTECTED] writes on Wed, 3 Dec 2008 07:13:14 -0800 (PST): To clarify again, Is there some function like profile.PrintStats() which dynamically shows the stats before stopping the Profiler? Try to (deep) copy the profiler instance and than call PrintStats() on the copy. Of course, you will then profile also the PrintStats in the running profiler. Dieter -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python using gprof
It should be the same as for any program $ program-compiled-with-pg $ gprof /path/to/program-compiled-with-pg you'll need to make sure that python is not only *compiled* with -pg but that the *link line* contains -pg as well. That's a common gotcha when it comes to profiling. Jeff pgpQyzwYpYrtn.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling Python using gprof
On Oct 11, Dave wrote: I would like to profile a Python program using gprof. I already rebuilt Python with CC=gcc -pg ./configure. So, I should be able to use gprof. How do I do that? Should I first run Python and then gprof? What are the steps? Note that it is much more common to use Python's profiling facilities to profile a Python program. So if you really want to profile the interpreter running your modules, then go ahead with gprof and follow Jeff's advice; otherwise see http://www.python.org/doc/2.4.2/lib/profile.html. -- Micah Elliott [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling python 2.3
In message [EMAIL PROTECTED], Kenneth Johansson [EMAIL PROTECTED] writes I wonder what would be a good way to profile a python program where the main thread starts two worker threads that do all the work. I get no infomation at all from the threads. Python Performance Validator (beta) http://www.softwareverify.com/pythonPerformanceValidator/index.html Stephen -- Stephen Kellett Object Media Limitedhttp://www.objmedia.demon.co.uk RSI Information:http://www.objmedia.demon.co.uk/rsi.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Profiling python 2.3
On Fri, 28 Jan 2005 10:02:33 +, Stephen Kellett wrote: In message [EMAIL PROTECTED], Kenneth Johansson [EMAIL PROTECTED] writes I wonder what would be a good way to profile a python program where the main thread starts two worker threads that do all the work. I get no infomation at all from the threads. Python Performance Validator (beta) http://www.softwareverify.com/pythonPerformanceValidator/index.html Stephen I develop on linux. Nice to see I do not have to recompile and relink to use the tool that's a real problem with other python stuff ;) -- http://mail.python.org/mailman/listinfo/python-list