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.100; helo=mga07.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 C51882119C8BC for ; Mon, 11 Jun 2018 01:32:29 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 01:32:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,501,1520924400"; d="scan'208";a="48906290" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga006.jf.intel.com with ESMTP; 11 Jun 2018 01:32:28 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Ruiyu Ni , Jaben Carsey Date: Mon, 11 Jun 2018 16:32:05 +0800 Message-Id: <20180611083206.106804-2-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 In-Reply-To: <20180611083206.106804-1-dandan.bi@intel.com> References: <20180611083206.106804-1-dandan.bi@intel.com> Subject: [patch V2 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, 11 Jun 2018 08:32:30 -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 Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Ruiyu Ni --- 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