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.24; helo=mga09.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 17D01203B9904 for ; Sun, 13 May 2018 22:46:38 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 May 2018 22:46:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,398,1520924400"; d="scan'208";a="39662483" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga008.fm.intel.com with ESMTP; 13 May 2018 22:46:36 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Ruiyu Ni Date: Mon, 14 May 2018 13:46:01 +0800 Message-Id: <20180514054602.103116-2-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 In-Reply-To: <20180514054602.103116-1-dandan.bi@intel.com> References: <20180514054602.103116-1-dandan.bi@intel.com> Subject: [patch 2/3] ShellPkg/Dp: Initialize summary date when run DP 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: Mon, 14 May 2018 05:46:38 -0000 Issue: When run "dp -s" or ("dp -v") command in shell several times, the summary reuslts are different each time. The root cause is that the previous global data "SummaryData" is not cleaned when the dp command is callled next time. This patch initializes the global data "SummaryData" when the dp dymanic command is called. Cc: Liming Gao Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index fe85937f557..d8451dbf59f 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -672,10 +672,28 @@ InitCumulativeData ( CumData[Index].MaxDur = 0; CumData[Index].Duration = 0; } } +/** + Initialize the Summary data. + +**/ +VOID +InitSummaryData ( + VOID + ) +{ + SummaryData.NumTrace = 0; + SummaryData.NumProfile = 0 ; + SummaryData.NumIncomplete = 0; + SummaryData.NumSummary = 0; + SummaryData.NumHandles = 0; + SummaryData.NumPEIMs = 0; + SummaryData.NumGlobal = 0; +} + /** Dump performance data. @param[in] ImageHandle The image handle. @param[in] SystemTable The system table. @@ -817,10 +835,15 @@ RunDp ( // // Initialize the pre-defined cumulative data. // InitCumulativeData (); + // + // Initialize the Summary data. + // + InitSummaryData (); + // // Init the custom cumulative data. // CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c"); if (CustomCumulativeToken != NULL) { -- 2.14.3.windows.1