Commit ba7177aa authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

get_concurrent_links: Stop honoring GYP_LINK_CONCURRENCY

gyp is long long gone. Hopefully nobody still set this.
(If you do: Set the concurrent_links gn arg instead.)

Bug: none
Change-Id: Ifef44f50825c15d89dff95af7597944bfdf87da0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2449935
Auto-Submit: Nico Weber <thakis@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#813973}
parent a18d8217
...@@ -62,31 +62,23 @@ def _GetDefaultConcurrentLinks(per_link_gb, reserve_gb, secondary_per_link_gb): ...@@ -62,31 +62,23 @@ def _GetDefaultConcurrentLinks(per_link_gb, reserve_gb, secondary_per_link_gb):
explanation.append( explanation.append(
'per_link_gb={} reserve_gb={} secondary_per_link_gb={}'.format( 'per_link_gb={} reserve_gb={} secondary_per_link_gb={}'.format(
per_link_gb, reserve_gb, secondary_per_link_gb)) per_link_gb, reserve_gb, secondary_per_link_gb))
# Inherit the legacy environment variable for people that have set it in GYP. mem_total_gb = float(_GetTotalMemoryInBytes()) / 2**30
num_links = int(os.getenv('GYP_LINK_CONCURRENCY', 0)) mem_total_gb = max(0, mem_total_gb - reserve_gb)
if num_links: mem_cap = int(max(1, mem_total_gb / per_link_gb))
reason = 'GYP_LINK_CONCURRENCY'
else:
mem_total_gb = float(_GetTotalMemoryInBytes()) / 2**30
mem_total_gb = max(0, mem_total_gb - reserve_gb)
mem_cap = int(max(1, mem_total_gb / per_link_gb))
hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32)))
try: try:
cpu_cap = multiprocessing.cpu_count() cpu_cap = multiprocessing.cpu_count()
except: except:
cpu_cap = 1 cpu_cap = 1
explanation.append('cpu_count={} mem_total_gb={:.1f}GiB'.format( explanation.append('cpu_count={} mem_total_gb={:.1f}GiB'.format(
cpu_cap, mem_total_gb)) cpu_cap, mem_total_gb))
num_links = min(mem_cap, hard_cap, cpu_cap) num_links = min(mem_cap, cpu_cap)
if num_links == cpu_cap: if num_links == cpu_cap:
reason = 'cpu_count' reason = 'cpu_count'
elif num_links == hard_cap: else:
reason = 'GYP_LINK_CONCURRENCY_MAX' reason = 'RAM'
else:
reason = 'RAM'
explanation.append('concurrent_links={} (reason: {})'.format( explanation.append('concurrent_links={} (reason: {})'.format(
num_links, reason)) num_links, reason))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment