comparison examples/bench/bigtable.py @ 815:bd1bed216344 trunk

Switch profiling in the benchmarks to cProfile.
author cmlenz
date Mon, 09 Mar 2009 16:14:43 +0000
parents 1da8de3e5e51
children
comparison
equal deleted inserted replaced
814:a5c74a9b9782 815:bd1bed216344
217 217
218 if __name__ == '__main__': 218 if __name__ == '__main__':
219 which = [arg for arg in sys.argv[1:] if arg[0] != '-'] 219 which = [arg for arg in sys.argv[1:] if arg[0] != '-']
220 220
221 if '-p' in sys.argv: 221 if '-p' in sys.argv:
222 import hotshot, hotshot.stats 222 import cProfile, pstats
223 prof = hotshot.Profile("template.prof") 223 prof = cProfile.Profile()
224 benchtime = prof.runcall(run, which, number=1) 224 prof.run('run(%r, number=1)' % which)
225 stats = hotshot.stats.load("template.prof") 225 stats = pstats.Stats(prof)
226 stats.strip_dirs() 226 stats.strip_dirs()
227 stats.sort_stats('time', 'calls') 227 stats.sort_stats('time', 'calls')
228 stats.print_stats() 228 stats.print_stats(25)
229 if '-v' in sys.argv:
230 stats.print_callees()
231 stats.print_callers()
229 else: 232 else:
230 run(which) 233 run(which)
Copyright (C) 2012-2017 Edgewall Software