import hotshot import hotshot.stats import meld3 # get rid of the noise of setting up an encoding # in profile output '.'.encode('utf-8') template = """ This is the title
This is the head slot
Name Description
""" class IO: def __init__(self): self.data = '' def write(self, data): self.data += data def run(root): clone = root.clone() print clone.getiterator() if __name__ == '__main__': profiler= hotshot.Profile("logfile.dat") root = meld3.parse_xmlstring(template) profiler.run("run(root)") profiler.close() stats = hotshot.stats.load("logfile.dat") stats.strip_dirs() #stats.sort_stats('cumulative', 'calls') stats.sort_stats('calls') stats.print_stats(200)