From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0EAD6210ED0F4 for ; Mon, 2 Jul 2018 22:42:18 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 22:42:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,302,1526367600"; d="scan'208";a="61873013" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 02 Jul 2018 22:42:17 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 22:42:18 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 22:42:17 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.87]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.51]) with mapi id 14.03.0319.002; Tue, 3 Jul 2018 13:42:15 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTool: Add cache for the result of SkipAutogen. Thread-Index: AQHUEaI8qxgIWPuCXUWVb0xdrJ1RxaR7PCEQ//9/swCAAkH8oA== Date: Tue, 3 Jul 2018 05:42:15 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2A1306@SHSMSX104.ccr.corp.intel.com> References: <20180702011547.314908-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E2A0919@SHSMSX104.ccr.corp.intel.com> <08650203BA1BD64D8AD9B6D5D74A85D15548921A@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <08650203BA1BD64D8AD9B6D5D74A85D15548921A@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTool: Add cache for the result of SkipAutogen. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 05:42:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable OK. Reviewed-by: Liming Gao >-----Original Message----- >From: Feng, Bob C >Sent: Monday, July 02, 2018 11:13 AM >To: Gao, Liming ; edk2-devel@lists.01.org >Cc: Feng, Bob C >Subject: RE: [Patch] BaseTool: Add cache for the result of SkipAutogen. > >Hi Liming, > >Based on my testing, a module will enter the CanSkip() multiple times even >after CanSkip() return True. >In this patch, I cache the module after CanSkip() return True to save the = cost >of later CanSkip() evaluation. >I think the CanSkip() will always return True after it return True at firs= t time in >one build process. > >Thanks, >Bob > >-----Original Message----- >From: Gao, Liming >Sent: Monday, July 02, 2018 10:53 AM >To: Feng, Bob C ; edk2-devel@lists.01.org >Subject: RE: [Patch] BaseTool: Add cache for the result of SkipAutogen. > >Bob: > When will this cache take effective? > >Thanks >Liming >>-----Original Message----- >>From: Feng, Bob C >>Sent: Monday, July 02, 2018 9:16 AM >>To: edk2-devel@lists.01.org >>Cc: Feng, Bob C ; Gao, Liming >> >>Subject: [Patch] 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 >>Cc: Liming Gao >>--- >> BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++++ >> BaseTools/Source/Python/Common/GlobalData.py | 1 + >> 2 files changed, 5 insertions(+) >> >>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >>b/BaseTools/Source/Python/AutoGen/AutoGen.py >>index 381dbc0a71..fc242992b7 100644 >>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >>@@ -4305,15 +4305,18 @@ class ModuleAutoGen(AutoGen): >> >> ## Decide whether we can skip the ModuleAutoGen process >> 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 >> DstTimeStamp =3D os.stat(self.GetTimeStampPath())[8] >> >>@@ -4328,10 +4331,11 @@ class ModuleAutoGen(AutoGen): >> return False >> if source not in ModuleAutoGen.TimeDict : >> ModuleAutoGen.TimeDict[source] =3D os.stat(source)[8= ] >> if ModuleAutoGen.TimeDict[source] > DstTimeStamp: >> return False >>+ GlobalData.gSikpAutoGenCache.add(self.MetaFile) >> return True >> >> def GetTimeStampPath(self): >> if self._TimeStampPath is None: >> self._TimeStampPath =3D os.path.join(self.MakeFileDir, >>'AutoGenTimeStamp') >>diff --git a/BaseTools/Source/Python/Common/GlobalData.py >>b/BaseTools/Source/Python/Common/GlobalData.py >>index afb3d8f020..fac7cde708 100644 >>--- a/BaseTools/Source/Python/Common/GlobalData.py >>+++ b/BaseTools/Source/Python/Common/GlobalData.py >>@@ -111,5 +111,6 @@ gBinCacheDest =3D None gBinCacheSource =3D None >>gPlatformHash =3D None gPackageHash =3D {} gModuleHash =3D {} >>gEnableGenfdsMultiThread =3D False >>+gSikpAutoGenCache =3D set() >>-- >>2.16.2.windows.1