Auto merge of #34614 - cynicaldevil:build-time, r=alexcrichton
Build: Shows total time taken to build the compiler Fixes #34600 Prints the total time taken to build rustc by executing `src/bootstrap/bootstrap.py`; also includes time taken to download `stage0` compiler and deps. r? @alexcrichton
This commit is contained in:
commit
da099c2322
1 changed files with 12 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -18,6 +19,8 @@ import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
from time import time
|
||||||
|
|
||||||
|
|
||||||
def get(url, path, verbose=False):
|
def get(url, path, verbose=False):
|
||||||
sha_url = url + ".sha256"
|
sha_url = url + ".sha256"
|
||||||
|
@ -118,6 +121,9 @@ def stage0_data(rust_root):
|
||||||
data[a] = b
|
data[a] = b
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def format_build_time(duration):
|
||||||
|
return str(datetime.timedelta(seconds=int(duration)))
|
||||||
|
|
||||||
class RustBuild:
|
class RustBuild:
|
||||||
def download_stage0(self):
|
def download_stage0(self):
|
||||||
cache_dst = os.path.join(self.build_dir, "cache")
|
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._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
|
||||||
rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
|
rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
|
||||||
|
|
||||||
|
start_time = time()
|
||||||
|
|
||||||
# Fetch/build the bootstrap
|
# Fetch/build the bootstrap
|
||||||
rb.build = rb.build_triple()
|
rb.build = rb.build_triple()
|
||||||
rb.download_stage0()
|
rb.download_stage0()
|
||||||
|
@ -390,5 +398,9 @@ def main():
|
||||||
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
|
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
|
||||||
rb.run(args, env)
|
rb.run(args, env)
|
||||||
|
|
||||||
|
end_time = time()
|
||||||
|
|
||||||
|
print("Build completed in %s" % format_build_time(end_time - start_time))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue