Commit 83d407a1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

get more profile results if PROFILE=1.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29955 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eace410c
...@@ -189,15 +189,23 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -189,15 +189,23 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
add_result = {} add_result = {}
# add object in bar module # add object in bar module
for i in xrange(10): for i in xrange(10):
def add():
for x in xrange(100):
p = self.bar_module.newContent(portal_type='Bar',
title='Bar Test',
quantity="%4d" %(x,))
before_add = time() before_add = time()
for x in xrange(100): if PROFILE:
p = self.bar_module.newContent(portal_type='Bar', self.profile(add, i)
title='Bar Test', else:
quantity="%4d" %(x,)) add()
after_add = time() after_add = time()
transaction.commit() transaction.commit()
before_tic = time() before_tic = time()
self.tic() if PROFILE:
self.profile(self.tic, i)
else:
self.tic()
after_tic = time() after_tic = time()
gc.collect() gc.collect()
before_form = time() before_form = time()
...@@ -276,6 +284,8 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -276,6 +284,8 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
( MIN_OBJECT_PROXYFIELD_VIEW, ( MIN_OBJECT_PROXYFIELD_VIEW,
req_time, req_time,
MAX_OBJECT_PROXYFIELD_VIEW ) MAX_OBJECT_PROXYFIELD_VIEW )
if PROFILE:
self.profile(foo.Foo_viewProxyField)
if DO_TEST: if DO_TEST:
self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time
< MAX_OBJECT_PROXYFIELD_VIEW, < MAX_OBJECT_PROXYFIELD_VIEW,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment