From 6a1494e5d76a4d03d4a0ba1847110df1a8d1c868 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Fri, 6 May 2022 01:22:16 +0000 Subject: [PATCH] Reland "autoninja: increase parallelism for non-HT cpu" This reverts commit 564f1eee9687fc1eb2bab0597f3524bf5ba91e8f. Reason for revert: fixed platform import Original change's description: > Revert "autoninja: increase parallelism for non-HT cpu" > > This reverts commit 06b18e4b690a0f6e1072cf5e7ded388ff199f600. > > Reason for revert: > platform is not imported > > Original change's description: > > autoninja: increase parallelism for non-HT cpu > > > > M1 mac seems to have capacity to build with higher parallelism. > > This also remove limit in macOS. > > > > Bug: 1317620 > > Change-Id: I4460915c405cbb27ed977dcee631adb8753f2335 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3596361 > > Commit-Queue: Takuto Ikuta > > Auto-Submit: Takuto Ikuta > > Reviewed-by: Junji Watanabe > > Reviewed-by: Fumitoshi Ukai > > Reviewed-by: Philipp Wollermann > > Reviewed-by: Bruce Dawson > > Commit-Queue: Bruce Dawson > > Bug: 1317620 > Change-Id: I325d0be8feca28e2f89a9191cfdb01de1f367d86 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3607513 > Auto-Submit: Takuto Ikuta > Bot-Commit: Rubber Stamper > Commit-Queue: Takuto Ikuta > Owners-Override: Takuto Ikuta Bug: 1317620 Change-Id: I2c3d817ca25cf6654864823788d3a8c473168942 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3612482 Reviewed-by: Fumitoshi Ukai Reviewed-by: Bruce Dawson Reviewed-by: Junji Watanabe Commit-Queue: Takuto Ikuta Auto-Submit: Takuto Ikuta --- autoninja.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/autoninja.py b/autoninja.py index 2ba7c864a..0e5f5a379 100755 --- a/autoninja.py +++ b/autoninja.py @@ -15,6 +15,7 @@ from __future__ import print_function import multiprocessing import os +import platform import re import subprocess import sys @@ -167,17 +168,21 @@ def main(args): if not j_specified and not t_specified: if use_goma or use_remoteexec: args.append('-j') - core_multiplier = int(os.environ.get('NINJA_CORE_MULTIPLIER', '40')) + default_core_multiplier = 80 + if platform.machine() in ('x86_64', 'AMD64'): + # Assume simultaneous multithreading and therefore half as many cores as + # logical processors. + num_cores //= 2 + + core_multiplier = int( + os.environ.get('NINJA_CORE_MULTIPLIER', default_core_multiplier)) + j_value = num_cores * core_multiplier if sys.platform.startswith('win'): # On windows, j value higher than 1000 does not improve build # performance. j_value = min(j_value, 1000) - elif sys.platform == 'darwin': - # On Mac, j value higher than 500 causes 'Too many open files' error - # (crbug.com/936864). - j_value = min(j_value, 500) args.append('%d' % j_value) else: