public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Ruiyu Ni <ruiyu.ni@intel.com>,
	Jaben Carsey <jaben.carsey@intel.com>
Subject: [patch V2 2/3] ShellPkg/Dp: Initialize summary date when run DP
Date: Mon, 11 Jun 2018 16:32:05 +0800	[thread overview]
Message-ID: <20180611083206.106804-2-dandan.bi@intel.com> (raw)
In-Reply-To: <20180611083206.106804-1-dandan.bi@intel.com>

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 <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
---
 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



  reply	other threads:[~2018-06-11  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11  8:32 [patch V2 1/3] ShellPkg/Dp: make sure memory is freed before exit Dandan Bi
2018-06-11  8:32 ` Dandan Bi [this message]
2018-06-12  8:10   ` [patch V2 2/3] ShellPkg/Dp: Initialize summary date when run DP Ni, Ruiyu
2018-06-11  8:32 ` [patch V2 3/3] ShellPkg/Dp: Make the help info align with code Dandan Bi
2018-06-12  4:21   ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180611083206.106804-2-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox