]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c
ShellPkg/Dp: Make the help info align with code
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / Dp.c
index fe85937f557b4ffdb64b31a6113baf5d072cb53e..38766613175510209794ecae049cb490316c30a0 100644 (file)
@@ -84,10 +84,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
   {L"-A", TypeFlag},   // -A   All, Cooked\r
   {L"-R", TypeFlag},   // -R   RAW All\r
   {L"-s", TypeFlag},   // -s   Summary\r
-#if PROFILING_IMPLEMENTED\r
-  {L"-P", TypeFlag},   // -P   Dump Profile Data\r
-  {L"-T", TypeFlag},   // -T   Dump Trace Data\r
-#endif // PROFILING_IMPLEMENTED\r
   {L"-x", TypeFlag},   // -x   eXclude Cumulative Items\r
   {L"-i", TypeFlag},   // -i   Display Identifier\r
   {L"-c", TypeValue},  // -c   Display cumulative data.\r
@@ -116,9 +112,6 @@ DumpStatistics( void )
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), mDpHiiHandle,    SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);\r
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDpHiiHandle,      SummaryData.NumPEIMs);\r
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle,    SummaryData.NumGlobal);\r
-#if PROFILING_IMPLEMENTED\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPROFILE), mDpHiiHandle,    SummaryData.NumProfile);\r
-#endif // PROFILING_IMPLEMENTED\r
   SHELL_FREE_NON_NULL (StringPtr);\r
   SHELL_FREE_NON_NULL (StringPtrUnknown);\r
 }\r
@@ -674,6 +667,23 @@ InitCumulativeData (
   }\r
 }\r
 \r
+/**\r
+  Initialize the Summary data.\r
+\r
+**/\r
+VOID\r
+InitSummaryData (\r
+  VOID\r
+  )\r
+{\r
+  SummaryData.NumTrace      = 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
@@ -703,8 +713,6 @@ RunDp (
   BOOLEAN                   VerboseMode;\r
   BOOLEAN                   AllMode;\r
   BOOLEAN                   RawMode;\r
-  BOOLEAN                   TraceMode;\r
-  BOOLEAN                   ProfileMode;\r
   BOOLEAN                   ExcludeMode;\r
   BOOLEAN                   CumulativeMode;\r
   CONST CHAR16              *CustomCumulativeToken;\r
@@ -718,8 +726,6 @@ RunDp (
   VerboseMode = FALSE;\r
   AllMode     = FALSE;\r
   RawMode     = FALSE;\r
-  TraceMode   = FALSE;\r
-  ProfileMode = FALSE;\r
   ExcludeMode = FALSE;\r
   CumulativeMode = FALSE;\r
   CustomCumulativeData = NULL;\r
@@ -747,10 +753,6 @@ RunDp (
   SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s"));\r
   AllMode     = ShellCommandLineGetFlag (ParamPackage, L"-A");\r
   RawMode     = ShellCommandLineGetFlag (ParamPackage, L"-R");\r
-#if PROFILING_IMPLEMENTED\r
-  TraceMode   = ShellCommandLineGetFlag (ParamPackage, L"-T");\r
-  ProfileMode = ShellCommandLineGetFlag (ParamPackage, L"-P");\r
-#endif  // PROFILING_IMPLEMENTED\r
   ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x");\r
   mShowId     = ShellCommandLineGetFlag (ParamPackage, L"-i");\r
   CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c");\r
@@ -773,14 +775,6 @@ RunDp (
     mInterestThreshold = StrDecimalToUint64(CmdLineArg);\r
   }\r
 \r
-  // Handle Flag combinations and default behaviors\r
-  // If both TraceMode and ProfileMode are FALSE, set them both to TRUE\r
-  if ((! TraceMode) && (! ProfileMode)) {\r
-    TraceMode   = TRUE;\r
-#if PROFILING_IMPLEMENTED\r
-    ProfileMode = TRUE;\r
-#endif  // PROFILING_IMPLEMENTED\r
-  }\r
 \r
   //\r
   // DP dump performance data by parsing FPDT table in ACPI table.\r
@@ -819,6 +813,11 @@ RunDp (
   //\r
   InitCumulativeData ();\r
 \r
+  //\r
+  // Initialize the Summary data.\r
+  //\r
+  InitSummaryData ();\r
+\r
   //\r
   // Init the custom cumulative data.\r
   //\r
@@ -896,67 +895,45 @@ RunDp (
 ****    R Raw         --  S option is ignored\r
 ****    s Summary     --  Modifies "Cooked" output only\r
 ****    Cooked (Default)\r
-****\r
-****  The All, Raw, and Cooked modes are modified by the Trace and Profile\r
-****  options.\r
-****    !T && !P  := (0) Default, Both are displayed\r
-****     T && !P  := (1) Only Trace records are displayed\r
-****    !T &&  P  := (2) Only Profile records are displayed\r
-****     T &&  P  := (3) Same as Default, both are displayed\r
 ****************************************************************************/\r
   GatherStatistics (CustomCumulativeData);\r
   if (CumulativeMode) {                       \r
     ProcessCumulative (CustomCumulativeData);\r
   } else if (AllMode) {\r
-    if (TraceMode) {\r
-      Status = DumpAllTrace( Number2Display, ExcludeMode);\r
+    Status = DumpAllTrace( Number2Display, ExcludeMode);\r
+    if (Status == EFI_ABORTED) {\r
+      ShellStatus = SHELL_ABORTED;\r
+      goto Done;\r
+    }\r
+  } else if (RawMode) {\r
+    Status = DumpRawTrace( Number2Display, ExcludeMode);\r
+    if (Status == EFI_ABORTED) {\r
+      ShellStatus = SHELL_ABORTED;\r
+      goto Done;\r
+    }\r
+  } else {\r
+    //------------- Begin Cooked Mode Processing\r
+    ProcessPhases ();\r
+    if ( ! SummaryMode) {\r
+      Status = ProcessHandles ( ExcludeMode);\r
       if (Status == EFI_ABORTED) {\r
         ShellStatus = SHELL_ABORTED;\r
         goto Done;\r
       }\r
-    }\r
-    if (ProfileMode) {\r
-      DumpAllProfile( Number2Display, ExcludeMode);\r
-    }\r
-  } else if (RawMode) {\r
-    if (TraceMode) {\r
-      Status = DumpRawTrace( Number2Display, ExcludeMode);\r
+\r
+      Status = ProcessPeims ();\r
       if (Status == EFI_ABORTED) {\r
         ShellStatus = SHELL_ABORTED;\r
         goto Done;\r
       }\r
-    }\r
-    if (ProfileMode) {\r
-      DumpRawProfile( Number2Display, ExcludeMode);\r
-    }\r
-  } else {\r
-    //------------- Begin Cooked Mode Processing\r
-    if (TraceMode) {\r
-      ProcessPhases ();\r
-      if ( ! SummaryMode) {\r
-        Status = ProcessHandles ( ExcludeMode);\r
-        if (Status == EFI_ABORTED) {\r
-          ShellStatus = SHELL_ABORTED;\r
-          goto Done;\r
-        }\r
-\r
-        Status = ProcessPeims ();\r
-        if (Status == EFI_ABORTED) {\r
-          ShellStatus = SHELL_ABORTED;\r
-          goto Done;\r
-        }\r
-\r
-        Status = ProcessGlobal ();\r
-        if (Status == EFI_ABORTED) {\r
-          ShellStatus = SHELL_ABORTED;\r
-          goto Done;\r
-        }\r
-\r
-        ProcessCumulative (NULL);\r
+\r
+      Status = ProcessGlobal ();\r
+      if (Status == EFI_ABORTED) {\r
+        ShellStatus = SHELL_ABORTED;\r
+        goto Done;\r
       }\r
-    }\r
-    if (ProfileMode) {\r
-      DumpAllProfile( Number2Display, ExcludeMode);\r
+\r
+       ProcessCumulative (NULL);\r
     }\r
   } //------------- End of Cooked Mode Processing\r
   if ( VerboseMode || SummaryMode) {\r