[Tutor] way to see code execution in real-time?

Alan Gauld alan.gauld at btinternet.com
Fri Oct 16 19:29:03 CEST 2009


"Serdar Tumgoren" <zstumgoren at gmail.com> wrote

> I was wondering -- is there a way to "watch" a program execute by
> piping a report of its actions to standard output or to a file?

There are tools for doing that - Look! - is one I know that works 
for C++ and Java but I don;t know iof any freware ones or that 
work for Python.

> Basically, I'd like to see the order that functions/methods are
> executing as they happen, along with how long each one takes.

You can run it in any debugger and use the step into/step over 
buttons to walk through the code. But it is extremely tiresome!
One of my colleagues once spent nearly two weeks stepping 
though some undocumented code we had been given to find 
out how it works. He was not a happy man.

If you do go that way I strongly recommend using a graphical 
front end like IDLE/Pythonwin/Eclipse(PyDev) etc.

> Is this something cProfile would do, or is there another tool built
> for that purpose?

Never come across cProfile but profiling tools  generally just 
give you a report at the ed of what has been executed.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list