diff options
author | Yunhua Feng <yunhuax.feng@intel.com> | 2018-01-11 17:11:20 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-01-15 19:51:21 +0800 |
commit | 29af38b0f8f2aa7b08f61a9df38a59dbc15e9302 (patch) | |
tree | c651bf4e37a895e63c329386e7256787794f82b0 /BaseTools/Source/Python/build | |
parent | 137ed15511e2045a7333e33ae7f1e873ce1961dd (diff) | |
download | edk2-29af38b0f8f2aa7b08f61a9df38a59dbc15e9302.tar.gz edk2-29af38b0f8f2aa7b08f61a9df38a59dbc15e9302.tar.bz2 edk2-29af38b0f8f2aa7b08f61a9df38a59dbc15e9302.zip |
BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER = 0 feature
when set 'MAX_CONCURRENT_THREAD_NUMBER=0', will auto-detect number of
processor threads as MAX_CONCURRENT_THREAD_NUMBER.
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=775
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/build')
-rw-r--r-- | BaseTools/Source/Python/build/build.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 38498046d7..de19756d99 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -2,7 +2,7 @@ # build a platform or a module
#
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -26,6 +26,7 @@ import platform import traceback
import encodings.ascii
import itertools
+import multiprocessing
from struct import *
from threading import *
@@ -936,7 +937,10 @@ class Build(): self.ThreadNumber = int(self.ThreadNumber, 0)
if self.ThreadNumber == 0:
- self.ThreadNumber = 1
+ try:
+ self.ThreadNumber = multiprocessing.cpu_count()
+ except (ImportError, NotImplementedError):
+ self.ThreadNumber = 1
if not self.PlatformFile:
PlatformFile = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM]
|