Skip to content
This repository has been archived by the owner on Mar 8, 2018. It is now read-only.

Commit

Permalink
Swap out statprof for hotshot profiling with these basic Performance …
Browse files Browse the repository at this point in the history
…test cases
  • Loading branch information
R. Tyler Ballance committed Oct 13, 2009
1 parent 8e4854e commit c8caedc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cheetah/Tests/Performance.py
Expand Up @@ -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
Expand Down Expand Up @@ -83,25 +84,25 @@ def test_BasicDynamic(self):
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):
Expand Down

0 comments on commit c8caedc

Please sign in to comment.