Permalink
Browse files

Updated rwbench

--HG--
branch : trunk
  • Loading branch information...
1 parent 02ea18a commit 5a8d49689a0cb5b517d784303cad4cc63cb6d927 @mitsuhiko mitsuhiko committed Jul 1, 2010
Showing with 13 additions and 0 deletions.
  1. +13 −0 examples/rwbench/rwbench.py
@@ -12,6 +12,11 @@
"""
import sys
from os.path import join, dirname, abspath
+try:
+ from cProfile import Profile
+except ImportError:
+ from profile import Profile
+from pstats import Stats
ROOT = abspath(dirname(__file__))
from random import choice, randrange
@@ -97,3 +102,11 @@ def test_genshi():
sys.stdout.write(' >> %-20s<running>' % test)
sys.stdout.flush()
sys.stdout.write('\r %-20s%.4f seconds\n' % (test, t.timeit(number=200) / 200))
+
+ if '-p' in sys.argv:
+ print 'Jinja profile'
+ p = Profile()
+ p.runcall(test_jinja)
+ stats = Stats(p)
+ stats.sort_stats('time', 'calls')
+ stats.print_stats()

0 comments on commit 5a8d496

Please sign in to comment.