BaseTool: Add cache for the result of SkipAutogen.

Add a cache for the value of skip ModuleAutoGen
process flag. This cache can improve build performance.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Feng, Bob C 2018-07-02 09:15:47 +08:00 committed by Liming Gao
parent f7496d7173
commit 18ef4e713f
2 changed files with 5 additions and 0 deletions

View File

@ -4309,11 +4309,14 @@ class ModuleAutoGen(AutoGen):
def CanSkipbyHash(self):
if GlobalData.gUseHashCache:
return not self.GenModuleHash()
return False
## Decide whether we can skip the ModuleAutoGen process
# If any source file is newer than the module than we cannot skip
#
def CanSkip(self):
if self.MetaFile in GlobalData.gSikpAutoGenCache:
return True
if not os.path.exists(self.GetTimeStampPath()):
return False
#last creation time of the module
@ -4332,6 +4335,7 @@ class ModuleAutoGen(AutoGen):
ModuleAutoGen.TimeDict[source] = os.stat(source)[8]
if ModuleAutoGen.TimeDict[source] > DstTimeStamp:
return False
GlobalData.gSikpAutoGenCache.add(self.MetaFile)
return True
def GetTimeStampPath(self):

View File

@ -113,3 +113,4 @@ gPlatformHash = None
gPackageHash = {}
gModuleHash = {}
gEnableGenfdsMultiThread = False
gSikpAutoGenCache = set()