ShellPkg/Dp: Initialize summary date when run DP
authorDandan Bi <dandan.bi@intel.com>
Sat, 12 May 2018 12:57:36 +0000 (20:57 +0800)
committerEric Dong <eric.dong@intel.com>
Tue, 12 Jun 2018 07:50:55 +0000 (15:50 +0800)
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

index fe85937f557b4ffdb64b31a6113baf5d072cb53e..d8451dbf59fa9f78160ca9ee540f60b112b37093 100644 (file)
@@ -674,6 +674,24 @@ InitCumulativeData (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  Initialize the Summary data.\r
+\r
+**/\r
+VOID\r
+InitSummaryData (\r
+  VOID\r
+  )\r
+{\r
+  SummaryData.NumTrace      = 0;\r
+  SummaryData.NumProfile    = 0 ;\r
+  SummaryData.NumIncomplete = 0;\r
+  SummaryData.NumSummary    = 0;\r
+  SummaryData.NumHandles    = 0;\r
+  SummaryData.NumPEIMs      = 0;\r
+  SummaryData.NumGlobal     = 0;\r
+}\r
+\r
 /**\r
   Dump performance data.\r
   \r
 /**\r
   Dump performance data.\r
   \r
@@ -819,6 +837,11 @@ RunDp (
   //\r
   InitCumulativeData ();\r
 \r
   //\r
   InitCumulativeData ();\r
 \r
+  //\r
+  // Initialize the Summary data.\r
+  //\r
+  InitSummaryData ();\r
+\r
   //\r
   // Init the custom cumulative data.\r
   //\r
   //\r
   // Init the custom cumulative data.\r
   //\r