holger krekel avatar holger krekel committed 2a7cba4

slight refactor of time-measurement code

Comments (0)

Files changed (1)

 import os
 import sys
 import subprocess
-import time
 from tox._verlib import NormalizedVersion, IrrationalVersionError
 from tox._venv import VirtualEnv
 from tox._config import parseconfig
 from subprocess import STDOUT
 
+def now():
+    return py.std.time.time()
+
 def main(args=None):
     try:
         config = parseconfig(args, 'tox')
     def __init__(self, session):
         self.tw = py.io.TerminalWriter()
         self.session = session
+        #self.cumulated_time = 0.0
 
     def logpopen(self, popen):
         """ log information about the action.popen() created process. """
     def logaction_start(self, action):
         msg = action.msg + " " + " ".join(map(str, action.args))
         self.verbosity1("%s start: %s" %(action.venvname, msg), bold=True)
-        self._starttime = time.time()
+        assert not hasattr(action, "_starttime")
+        action._starttime = now()
 
     def logaction_finish(self, action):
-        duration = time.time() - self._starttime
-        self.verbosity1("%s finish: %s in %.2f seconds" %(
+        duration = now() - action._starttime
+        #self.cumulated_time += duration
+        self.verbosity1("%s finish: %s after %.2f seconds" %(
             action.venvname, action.msg, duration), bold=True)
 
     def startsummary(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.