aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-02-26 15:24:43 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-02-26 15:24:43 -0800
commit9d6139a6f6fae12e941023a5c2c7f1025884c639 (patch)
tree0a0d89a91dc9a017c0a1798893f224451e33ae6b /tools
parent238cdbf2c9e3317f1648cab31de3d311d5f94b79 (diff)
Add timer to run_tests.py
For future profiling work to eliminate/speed-up slow tests.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run_tests/jobset.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index 575d2c5902..22d24c124c 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -161,6 +161,7 @@ class Job(object):
env = os.environ.copy()
for k, v in spec.environ.iteritems():
env[k] = v
+ self._start = time.time()
self._process = subprocess.Popen(args=spec.cmdline,
stderr=subprocess.STDOUT,
stdout=self._tempfile,
@@ -174,6 +175,7 @@ class Job(object):
def state(self, update_cache):
"""Poll current state of the job. Prints messages at completion."""
if self._state == _RUNNING and self._process.poll() is not None:
+ elapsed = time.time() - self._start
if self._process.returncode != 0:
self._state = _FAILURE
self._tempfile.seek(0)
@@ -182,7 +184,7 @@ class Job(object):
self._spec.shortname, self._process.returncode), stdout)
else:
self._state = _SUCCESS
- message('PASSED', self._spec.shortname,
+ message('PASSED', '%s [time=%.1fsec]' % (self._spec.shortname, elapsed),
do_newline=self._newline_on_success or self._travis)
if self._bin_hash:
update_cache.finished(self._spec.identity(), self._bin_hash)