Skip to content

Commit

Permalink
BaseTool: Add cache for the result of SkipAutogen.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Liming Gao <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
  • Loading branch information
BobCF authored and lgao4 committed Jul 9, 2018
1 parent f7496d7 commit 18ef4e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BaseTools/Source/Python/AutoGen/AutoGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4309,11 +4309,14 @@ def GenModuleHash(self):
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
Expand All @@ -4332,6 +4335,7 @@ def CanSkip(self):
ModuleAutoGen.TimeDict[source] = os.stat(source)[8]
if ModuleAutoGen.TimeDict[source] > DstTimeStamp:
return False
GlobalData.gSikpAutoGenCache.add(self.MetaFile)
return True

def GetTimeStampPath(self):
Expand Down
1 change: 1 addition & 0 deletions BaseTools/Source/Python/Common/GlobalData.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@
gPackageHash = {}
gModuleHash = {}
gEnableGenfdsMultiThread = False
gSikpAutoGenCache = set()

0 comments on commit 18ef4e7

Please sign in to comment.