You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/10/24 20:31:20 UTC

[42/50] [abbrv] git commit: updated refs/heads/ui-restyle to 500c798

CLOUDSTACK-4885: basic timing profiler for tests

This will add time taken in seconds along with start and end timestamp
logging facility for test cases.Currently this is not
available for console logs

Signed-off-by: Santhosh Edukulla <Sa...@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/07806045
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/07806045
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/07806045

Branch: refs/heads/ui-restyle
Commit: 078060450320a0c4222f8436248b3c1b891257c4
Parents: c25b583
Author: Santhosh Edukulla <Sa...@citrix.com>
Authored: Thu Oct 24 00:13:01 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Oct 24 14:52:53 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/marvinPlugin.py | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07806045/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index aded17c..3b282e4 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -22,6 +22,7 @@ import nose.core
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin import deployDataCenter
 from nose.plugins.base import Plugin
+import time
 
 
 class MarvinPlugin(Plugin):
@@ -121,10 +122,28 @@ class MarvinPlugin(Plugin):
             self.config = config
 
     def beforeTest(self, test):
-        testname = test.__str__().split()[0]
-        self.testclient.identifier = '-'.join([self.identifier, testname])
+        self.testName = test.__str__().split()[0]
+        self.testclient.identifier = '-'.join([self.identifier, self.testName])
         self.logger.name = test.__str__()
 
+    def startTest(self, test):
+        """
+        Currently used to record start time for tests
+        """
+        self.startTime = time.time()
+
+    def stopTest(self, test):
+        """
+        Currently used to record end time for tests
+        """
+        endTime = time.time()
+        if self.startTime is not None:
+            totTime = int(endTime - self.startTime)
+            self.logger.debug(
+                "****TestCaseName: %s; Time Taken: %s Seconds; \
+                StartTime: %s; EndTime: %s****"
+                % (self.testName, str(totTime), self.startTime, endTime))
+
     def _injectClients(self, test):
         self.debug_stream. \
             setFormatter(logging.