diff options
author | R. Tyler Ballance <tyler@monkeypox.org> | 2009-10-12 21:48:32 -0700 |
---|---|---|
committer | R. Tyler Ballance <tyler@monkeypox.org> | 2009-10-12 23:15:11 -0700 |
commit | c8caedc6222e22420a4d7fd433a0cfc43fca3a3b (patch) | |
tree | 212557ef38efe314d33f7e81bf2ecc719caec110 | |
parent | 8e4854eb955556452a2939ab9f946dc16a10a013 (diff) | |
download | python-cheetah-c8caedc6222e22420a4d7fd433a0cfc43fca3a3b.tar.gz |
Swap out statprof for hotshot profiling with these basic Performance test cases
-rw-r--r-- | cheetah/Tests/Performance.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/cheetah/Tests/Performance.py b/cheetah/Tests/Performance.py index 0f7d613..213a02b 100644 --- a/cheetah/Tests/Performance.py +++ b/cheetah/Tests/Performance.py @@ -2,8 +2,9 @@ import Cheetah.NameMapper import Cheetah.Template -from Cheetah.Utils import statprof +import hotshot +import hotshot.stats import os import sys import unittest @@ -83,25 +84,25 @@ class DynamicTemplatePerformanceTest(unittest.TestCase): test_BasicDynamic = perftest(1200)(test_BasicDynamic) class PerformanceTest(unittest.TestCase): - iterations = 1000000 + iterations = 100000 display = False - def setUp(self): - super(PerformanceTest, self).setUp() - statprof.start() def runTest(self): + self.prof = hotshot.Profile('%s.prof' % self.__class__.__name__) + self.prof.start() for i in xrange(self.iterations): if hasattr(self, 'performanceSample'): self.display = True self.performanceSample() - - def tearDown(self): - super(PerformanceTest, self).tearDown() - statprof.stop() + self.prof.stop() + self.prof.close() if self.display: print '>>> %s (%d iterations) ' % (self.__class__.__name__, self.iterations) - statprof.display() + stats = hotshot.stats.load('%s.prof' % self.__class__.__name__) + stats.strip_dirs() + stats.sort_stats('time', 'calls') + stats.print_stats(40) class DynamicMethodCompilationTest(PerformanceTest): def performanceSample(self): |