summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-12-23 16:35:54 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2014-12-23 16:35:54 -0800
commit852c1dc2866fc59b6250288aad6c8d7c988588a8 (patch)
tree66ce5a19174094c6fded5f351a1ea19959ee5a6d /lib
parent01ca61c7cce510f7f80912f5b01bd69043de7008 (diff)
downloadspack-852c1dc2866fc59b6250288aad6c8d7c988588a8.tar.gz
spack-852c1dc2866fc59b6250288aad6c8d7c988588a8.tar.bz2
spack-852c1dc2866fc59b6250288aad6c8d7c988588a8.tar.xz
spack-852c1dc2866fc59b6250288aad6c8d7c988588a8.zip
Print out fetch, build, and total time for builds.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index fa91dbbbea..4ab7ff23cf 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -35,6 +35,7 @@ README.
"""
import os
import re
+import time
import inspect
import subprocess
import platform as py_platform
@@ -390,6 +391,10 @@ class Package(object):
if not hasattr(self, 'list_depth'):
self.list_depth = 1
+ # Set up some internal variables for timing.
+ self._fetch_time = 0.0
+ self._total_time = 0.0
+
@property
def version(self):
@@ -606,6 +611,7 @@ class Package(object):
if not self.spec.concrete:
raise ValueError("Can only fetch concrete packages.")
+ start_time = time.time()
if spack.do_checksum and not self.version in self.versions:
tty.warn("There is no checksum on file to fetch %s safely."
% self.spec.format('$_$@'))
@@ -624,6 +630,7 @@ class Package(object):
"Will not fetch %s." % self.spec.format('$_$@'), checksum_msg)
self.stage.fetch()
+ self._fetch_time = time.time() - start_time
if spack.do_checksum and self.version in self.versions:
self.stage.check()
@@ -720,6 +727,7 @@ class Package(object):
if not ignore_deps:
self.do_install_dependencies()
+ start_time = time.time()
if not fake_install:
self.do_patch()
@@ -765,7 +773,13 @@ class Package(object):
if not keep_stage:
self.stage.destroy()
- tty.msg("Successfully installed %s" % self.name)
+ # Stop timer.
+ self._total_time = time.time() - start_time
+ build_time = self._total_time - self._fetch_time
+
+ tty.msg("Successfully installed %s." % self.name,
+ "Fetch: %.2f sec. Build: %.2f sec. Total: %.2f sec."
+ % (self._fetch_time, build_time, self._total_time))
print_pkg(self.prefix)
# Use os._exit here to avoid raising a SystemExit exception,