re-land increase of linker pool for android builder

This is re-land of
https://chromium-review.googlesource.com/894928

I changed to use cpu core for restriction and use lower memory limit only on
non-debug and non-sanitizer build.

I explained more detailed intention of my cl in
https://bugs.chromium.org/p/chromium/issues/detail?id=808582#c10


Bug: 808582, 804251
Change-Id: Ic98e9ffd7497a63c3aa98ec50b06f90c225d0107
Reviewed-on: https://chromium-review.googlesource.com/900611
Commit-Queue: Takuto Ikuta <tikuta@google.com>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#534637}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 880379154e507eecff550d10feb1d8b8cc7e6ea2
This commit is contained in:
Takuto Ikuta 2018-02-06 05:36:09 +00:00 коммит произвёл Commit Bot
Родитель ac54aef545
Коммит b948ba9565
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -36,7 +36,13 @@ if (concurrent_links == -1) {
} else if (is_mac) {
_args = [ "--mem_per_link_gb=4" ]
} else if (is_android && !is_component_build && symbol_level == 2) {
# Full debug symbols require large memory for link.
_args = [ "--mem_per_link_gb=25" ]
} else if (is_android && !is_debug && !using_sanitizer && symbol_level == 1) {
# Increase the number of concurrent links for release bots. Debug builds
# make heavier use of ProGuard, and so should not be raised. Sanitizers also
# increase the memory overhead.
_args = [ "--mem_per_link_gb=4" ]
} else if (is_linux && !is_chromeos && symbol_level == 1) {
_args = [ "--mem_per_link_gb=3" ]
} else {

Просмотреть файл

@ -5,6 +5,7 @@
# 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 multiprocessing
import optparse
import os
import re
@ -59,7 +60,13 @@ def _GetDefaultConcurrentLinks(mem_per_link_gb, reserve_mem_gb):
mem_total_bytes = max(0, mem_total_bytes - reserve_mem_gb * 2**30)
num_concurrent_links = int(max(1, mem_total_bytes / mem_per_link_gb / 2**30))
hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32)))
return min(num_concurrent_links, hard_cap)
try:
cpu_cap = multiprocessing.cpu_count()
except:
cpu_cap = 1
return min(num_concurrent_links, hard_cap, cpu_cap)
def main():