Mercurial > genshi > genshi-test
diff examples/bench/basic.py @ 815:7d94b77281f2
Switch profiling in the benchmarks to cProfile.
author | cmlenz |
---|---|
date | Mon, 09 Mar 2009 16:14:43 +0000 |
parents | 72e1a2ed04a0 |
children |
line wrap: on
line diff
--- a/examples/bench/basic.py +++ b/examples/bench/basic.py @@ -190,12 +190,15 @@ verbose = '-v' in sys.argv if '-p' in sys.argv: - import hotshot, hotshot.stats - prof = hotshot.Profile("template.prof") - benchtime = prof.runcall(run, engines, number=100, verbose=verbose) - stats = hotshot.stats.load("template.prof") + import cProfile, pstats + prof = cProfile.Profile() + prof.run('run(%r, number=200, verbose=%r)' % (engines, verbose)) + stats = pstats.Stats(prof) stats.strip_dirs() - stats.sort_stats('time', 'calls') - stats.print_stats(.05) + stats.sort_stats('calls') + stats.print_stats(25) + if verbose: + stats.print_callees() + stats.print_callers() else: run(engines, verbose=verbose)