[Python-Dev] Hotshot

Walter Dörwald walter at livinglogic.de
Sat Jan 24 07:03:01 EST 2004

Fred L. Drake, Jr. wrote:

> Nick Bastin writes:
>  > Does anybody know the current state of hotshot?  I read on some of the 
>  > twisted mailing lists a while back that someone tried it but had some 
>  > problems (can't remember what off the top of my head...have to search 
>  > the archives), and was wondering if it was regarded as complete (and if 
>  > there was any documentation that talks about how the code coverage 
>  > aspect is supposed to be used).
> HotShot has had some attention, and has been found useful, but I don't
> think of it as really finished.

What's missing from hotshot is a little script that makes it
possible to use hotshot from the command line (just like
profile.py), i.e. something like this:

import sys, os.path, hotshot, hotshot.stats

prof = hotshot.Profile("hotshot.prof")
filename = sys.argv[1]
del sys.argv[0]
sys.path.insert(0, os.path.dirname(filename))
prof.run("execfile(%r)" % filename)
stats = hotshot.stats.load("hotshot.prof")
stats.sort_stats("time", "calls")

The biggest problem I had with hotshot is the filesize. I was
using the above script to profile a script which normally
runs for about 10-15 minutes. After ca. 20 minutes the size
of hotshot.prof was over 1 gig. Is there any possibility to
reduce the filesize?

    Walter Dörwald

More information about the Python-Dev mailing list