aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2010-07-01 12:15:35 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2010-07-01 12:15:35 +0200
commit5a8d49689a0cb5b517d784303cad4cc63cb6d927 (patch)
tree9ded5f134c66ef7aa0f48fe173d9dab741b16057 /examples
parent02ea18a29d171767fc3f224d9e8e5303977f80f2 (diff)
downloadjinja-5a8d49689a0cb5b517d784303cad4cc63cb6d927.tar.gz
Updated rwbench
--HG-- branch : trunk
Diffstat (limited to 'examples')
-rw-r--r--examples/rwbench/rwbench.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/rwbench/rwbench.py b/examples/rwbench/rwbench.py
index 9cb3195a..813dd56c 100644
--- a/examples/rwbench/rwbench.py
+++ b/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 @@ if __name__ == '__main__':
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()