Chromium Code Reviews| Index: build/toolchain/get_concurrent_links.py |
| diff --git a/build/toolchain/get_concurrent_links.py b/build/toolchain/get_concurrent_links.py |
| index f8c927b8ec2c7e90544e5d1c5e47f8ef0236d266..c17eee999fc5c354f20529ea9e422543a0f1d901 100644 |
| --- a/build/toolchain/get_concurrent_links.py |
| +++ b/build/toolchain/get_concurrent_links.py |
| @@ -5,12 +5,13 @@ |
| # This script computs the number of concurrent links we want to run in the build |
| # as a function of machine spec. It's based on GetDefaultConcurrentLinks in GYP. |
| +import optparse |
| import os |
| import re |
| import subprocess |
| import sys |
| -def GetDefaultConcurrentLinks(): |
| +def GetDefaultConcurrentLinks(is_lto=False): |
|
Dirk Pranke
2015/12/03 23:19:08
nit: don't specify a default argument, since it'll
krasin
2015/12/03 23:22:20
Done.
|
| # Inherit the legacy environment variable for people that have set it in GYP. |
| pool_size = int(os.getenv('GYP_LINK_CONCURRENCY', 0)) |
| if pool_size: |
| @@ -49,7 +50,11 @@ def GetDefaultConcurrentLinks(): |
| if not match: |
| continue |
| # Allow 8Gb per link on Linux because Gold is quite memory hungry |
| - return max(1, int(match.group(1)) / (8 * (2 ** 20))) |
| + # For LTO builds the RAM requirements are even higher |
| + # Note: it's 15 GB for LTO build to make sure we get 4 link jobs |
| + # for 64 GB, even if the system reports a couple of GBs less. |
| + ram_per_link_gb = 15 if is_lto else 8 |
| + return max(1, int(match.group(1)) / (ram_per_link_gb * (2 ** 20))) |
| return 1 |
| elif sys.platform == 'darwin': |
| try: |
| @@ -63,4 +68,15 @@ def GetDefaultConcurrentLinks(): |
| # TODO(scottmg): Implement this for other platforms. |
| return 1 |
| -print GetDefaultConcurrentLinks() |
| +def main(): |
| + parser = optparse.OptionParser() |
| + parser.add_option('--lto', action="store_true", default=False, |
| + help='This is an LTO build with higher memory requirements') |
| + parser.disable_interspersed_args() |
| + options, args = parser.parse_args() |
| + |
| + print GetDefaultConcurrentLinks(is_lto=options.lto) |
| + return 0 |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |