How to do per-line profiling?

Alex Martelli aleax at aleax.it
Sun Apr 13 12:28:15 EDT 2003


Roy Smith wrote:

> Are there any tools to do profiling on a line-by-line basis?

Yes, package hotshot (part of the standard Python library) is just 
such a tool.  Unfortunately, it's somewhat under-documented!  And,
that's one tidbit where I even gave up when I was writing "Python
in a Nutshell"... I only documented the standard profiler, not hotshot.

I do have about half of each of a user guide and reference for
hotshot written -- at draft level; about 1300 words for the UG
and 900 for the Reference -- I had started writing them for Strakt,
but then ended up giving direct help to my colleagues trying to
use hotshot for a very specific and arduous task (profiling an
asynchronous multi-threaded GUI-rich client...) rather than writing
the rest of the general docs for "sane" use cases.  Now, I hear
that with Python 2.3 it may be the case that hotshot doesn't work
reliably any longer for line-by-line profiling, so, I dunno whether
it's worth pursuing the task of documenting it -- maybe people on
the Python core team are better placed to commend on that!


Alex





More information about the Python-list mailing list