summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-03-29 12:59:43 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-13 09:31:16 +0800
commitdf864bc81f4ceef5d4c3c7b099259318f71ca699 (patch)
tree4abad7222ae45a65b4693aec13e2f6246f83c214 /BaseTools/Source/Python
parenteb60a0e4e6c090cf4d8b5422c952253b958a214b (diff)
downloadedk2-platforms-df864bc81f4ceef5d4c3c7b099259318f71ca699.tar.xz
BaseTools: cache the defined Guid tool to improve the performance
Current GenFds Tool class GuidSection() is parsing the tools_def.txt for every GUID'ed section that has a GUID defined tool, it cause a bad performance. so this patch cache the defined Guid tool to improve the performance. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> (cherry picked from commit 213ae07750fc7532e8ba62a234e958388d1f0359)
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py3
-rw-r--r--BaseTools/Source/Python/GenFds/GuidSection.py8
2 files changed, 8 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index 8a974236f2..d1c9aff8d0 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -1,7 +1,7 @@
## @file
# Global variables for GenFds
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2016, 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
@@ -68,6 +68,7 @@ class GenFdsGlobalVariable:
BuildRuleFamily = "MSFT"
ToolChainFamily = "MSFT"
__BuildRuleDatabase = None
+ GuidToolDefinition = {}
#
# The list whose element are flags to indicate if large FFS or SECTION files exist in FV.
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py
index cc0c05a28c..ac5ae585f9 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -1,7 +1,7 @@
## @file
# process GUIDed section generation
#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2016, 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
@@ -268,6 +268,10 @@ class GuidSection(GuidSectionClassObject) :
if Target + '_' + ToolChain + '_' + Arch not in self.KeyStringList:
self.KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)
+ if GenFdsGlobalVariable.GuidToolDefinition:
+ if self.NameGuid in GenFdsGlobalVariable.GuidToolDefinition.keys():
+ return GenFdsGlobalVariable.GuidToolDefinition[self.NameGuid]
+
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
ToolPathTmp = None
ToolOption = None
@@ -298,7 +302,7 @@ class GuidSection(GuidSectionClassObject) :
if ToolPathTmp != ToolPath:
EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))
-
+ GenFdsGlobalVariable.GuidToolDefinition[self.NameGuid] = (ToolPathTmp, ToolOption)
return ToolPathTmp, ToolOption