diff 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
line wrap: on
line diff
--- a/examples/bench/bigtable.py
+++ b/examples/bench/bigtable.py
@@ -219,12 +219,15 @@
     which = [arg for arg in sys.argv[1:] if arg[0] != '-']
 
     if '-p' in sys.argv:
-        import hotshot, hotshot.stats
-        prof = hotshot.Profile("template.prof")
-        benchtime = prof.runcall(run, which, number=1)
-        stats = hotshot.stats.load("template.prof")
+        import cProfile, pstats
+        prof = cProfile.Profile()
+        prof.run('run(%r, number=1)' % which)
+        stats = pstats.Stats(prof)
         stats.strip_dirs()
         stats.sort_stats('time', 'calls')
-        stats.print_stats()
+        stats.print_stats(25)
+        if '-v' in sys.argv:
+            stats.print_callees()
+            stats.print_callers()
     else:
         run(which)
Copyright (C) 2012-2017 Edgewall Software