From 83d407a1ca9aec598ae8c7dc449f5ece769fceb8 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Fri, 23 Oct 2009 07:29:52 +0000 Subject: [PATCH] get more profile results if PROFILE=1. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29955 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/tests/testPerformance.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/product/ERP5Type/tests/testPerformance.py b/product/ERP5Type/tests/testPerformance.py index 1bb6f212d1..d5c637b32d 100644 --- a/product/ERP5Type/tests/testPerformance.py +++ b/product/ERP5Type/tests/testPerformance.py @@ -189,15 +189,23 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): add_result = {} # add object in bar module 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() - for x in xrange(100): - p = self.bar_module.newContent(portal_type='Bar', - title='Bar Test', - quantity="%4d" %(x,)) + if PROFILE: + self.profile(add, i) + else: + add() after_add = time() transaction.commit() before_tic = time() - self.tic() + if PROFILE: + self.profile(self.tic, i) + else: + self.tic() after_tic = time() gc.collect() before_form = time() @@ -276,6 +284,8 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ( MIN_OBJECT_PROXYFIELD_VIEW, req_time, MAX_OBJECT_PROXYFIELD_VIEW ) + if PROFILE: + self.profile(foo.Foo_viewProxyField) if DO_TEST: self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time < MAX_OBJECT_PROXYFIELD_VIEW, -- 2.30.9