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>
This commit is contained in:
Yunhua Feng 2018-01-11 17:11:20 +08:00 committed by Yonghong Zhu
parent 137ed15511
commit 29af38b0f8
1 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# build a platform or a module # build a platform or a module
# #
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -26,6 +26,7 @@ import platform
import traceback import traceback
import encodings.ascii import encodings.ascii
import itertools import itertools
import multiprocessing
from struct import * from struct import *
from threading import * from threading import *
@ -936,6 +937,9 @@ class Build():
self.ThreadNumber = int(self.ThreadNumber, 0) self.ThreadNumber = int(self.ThreadNumber, 0)
if self.ThreadNumber == 0: if self.ThreadNumber == 0:
try:
self.ThreadNumber = multiprocessing.cpu_count()
except (ImportError, NotImplementedError):
self.ThreadNumber = 1 self.ThreadNumber = 1
if not self.PlatformFile: if not self.PlatformFile: