From 5a8d49689a0cb5b517d784303cad4cc63cb6d927 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 1 Jul 2010 12:15:35 +0200 Subject: [PATCH] Updated rwbench --HG-- branch : trunk --- examples/rwbench/rwbench.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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' % 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() -- 2.47.2