Extracting results from a large hotshot profile

Brian Cole brianc at temple.edu
Mon Jan 16 10:04:24 EST 2006


I'm profiling some code that screens a large database. The algorithm
efficiency is heavily variable, based upon the different records in
the database. In order to get a sense of the best place to start
optimizing the code I did a hotshot profile. To make this profile took
about a day. However, I've been trying to extract results from the
profile for the past two days. It's eating up all the memory (2G
memory) on the machine and is slowing sucking up the swap space
(another 2G).

I'm hesitant to kill it for I might get results out of it some day
(even if I may have to bequeath them to my grand-children), but is
there a better way to do this?

I'm using the following script to print my results:
import sys
import hotshot.stats
stats = hotshot.stats.load(sys.argv[1])
stats.strip_dirs()
stats.sort_stats('time', 'calls')
stats.print_stats(20)

The profile is 355 MB large. Is there anything I can do to extract that data?

Thanks in advance,
Brian Cole



More information about the Python-list mailing list