]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: cache the defined Guid tool to improve the performance
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 29 Mar 2016 04:59:43 +0000 (12:59 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 6 Apr 2016 05:40:14 +0000 (13:40 +0800)
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>
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools/Source/Python/GenFds/GuidSection.py

index 8a974236f22135abe5934e4dd3955c0bc569003e..d1c9aff8d062512a8912b73f63a5bea48d1f033b 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Global variables for GenFds\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -68,6 +68,7 @@ class GenFdsGlobalVariable:
     BuildRuleFamily = "MSFT"\r
     ToolChainFamily = "MSFT"\r
     __BuildRuleDatabase = None\r
+    GuidToolDefinition = {}\r
     \r
     #\r
     # The list whose element are flags to indicate if large FFS or SECTION files exist in FV.\r
index cc0c05a28c1e275c987a3f80e5f230ed67185d93..ac5ae585f90f437f9b929f795c2cae3c3d75a46e 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process GUIDed section generation\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -268,6 +268,10 @@ class GuidSection(GuidSectionClassObject) :
                 if Target + '_' + ToolChain + '_' + Arch not in self.KeyStringList:\r
                     self.KeyStringList.append(Target + '_' + ToolChain + '_' + Arch)\r
 \r
+        if GenFdsGlobalVariable.GuidToolDefinition:\r
+            if self.NameGuid in GenFdsGlobalVariable.GuidToolDefinition.keys():\r
+                return GenFdsGlobalVariable.GuidToolDefinition[self.NameGuid]\r
+\r
         ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary\r
         ToolPathTmp = None\r
         ToolOption = None\r
@@ -298,7 +302,7 @@ class GuidSection(GuidSectionClassObject) :
                         if ToolPathTmp != ToolPath:\r
                             EdkLogger.error("GenFds", GENFDS_ERROR, "Don't know which tool to use, %s or %s ?" % (ToolPathTmp, ToolPath))\r
 \r
-\r
+        GenFdsGlobalVariable.GuidToolDefinition[self.NameGuid] = (ToolPathTmp, ToolOption)\r
         return ToolPathTmp, ToolOption\r
 \r
 \r