]> git.lizzy.rs Git - rust.git/commitdiff
Build: Shows total time taken to build the compiler
authorNikhil Shagrithaya <nikhilshagri@gmail.com>
Sat, 2 Jul 2016 14:19:27 +0000 (19:49 +0530)
committerNikhil Shagrithaya <nikhilshagri@gmail.com>
Sat, 2 Jul 2016 14:23:02 +0000 (19:53 +0530)
src/bootstrap/bootstrap.py

index 7b0a5d6b6dfc4fcbc38f2f5b46281ad914a3fce6..1b50f6573ebf49bc6642fa22b5610e4efaea9c8f 100644 (file)
@@ -10,6 +10,7 @@
 
 import argparse
 import contextlib
+import datetime
 import hashlib
 import os
 import shutil
@@ -18,6 +19,8 @@ import sys
 import tarfile
 import tempfile
 
+from time import time
+
 
 def get(url, path, verbose=False):
     sha_url = url + ".sha256"
@@ -118,6 +121,9 @@ def stage0_data(rust_root):
             data[a] = b
     return data
 
+def format_build_time(duration):
+    return str(datetime.timedelta(seconds=int(duration)))
+
 class RustBuild:
     def download_stage0(self):
         cache_dst = os.path.join(self.build_dir, "cache")
@@ -372,6 +378,8 @@ def main():
     rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
     rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
 
+    start_time = time()
+
     # Fetch/build the bootstrap
     rb.build = rb.build_triple()
     rb.download_stage0()
@@ -390,5 +398,9 @@ def main():
     env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
     rb.run(args, env)
 
+    end_time = time()
+
+    print("Build completed in %s" % format_build_time(end_time - start_time))
+
 if __name__ == '__main__':
     main()