summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@monkeypox.org>2009-10-12 21:48:32 -0700
committerR. Tyler Ballance <tyler@monkeypox.org>2009-10-15 07:30:38 -0700
commitc93d8b2020cbdd0b300982210cdd44382d7fc38e (patch)
tree5882c629f29eaef40969b4a73aeafaf70d6c373e
parentc63d16c0db9e63cd6bfc847d8c5a5cfcec19d4bf (diff)
downloadpython-cheetah-c93d8b2020cbdd0b300982210cdd44382d7fc38e.tar.gz
Swap out statprof for hotshot profiling with these basic Performance test cases
-rw-r--r--cheetah/Tests/Performance.py21
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):