]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / DpTrace.c
index 1a247d4bd492c52f5a3614afc976600fc41204c3..0abb8797ec6006b63e7512b51b27f945264fcc98 100644 (file)
 **/\r
 UINTN\r
 GetPerformanceMeasurementRecord (\r
IN  UINTN       LogEntryKey,\r
OUT CONST VOID  **Handle,\r
OUT CONST CHAR8 **Token,\r
OUT CONST CHAR8 **Module,\r
OUT UINT64      *StartTimeStamp,\r
OUT UINT64      *EndTimeStamp,\r
OUT UINT32      *Identifier\r
 IN  UINTN        LogEntryKey,\r
 OUT CONST VOID   **Handle,\r
 OUT CONST CHAR8  **Token,\r
 OUT CONST CHAR8  **Module,\r
 OUT UINT64       *StartTimeStamp,\r
 OUT UINT64       *EndTimeStamp,\r
 OUT UINT32       *Identifier\r
   )\r
 {\r
   if (LogEntryKey == mMeasurementNum) {\r
     return 0;\r
   }\r
 \r
-  *Handle         = (VOID *) (UINTN) mMeasurementList[LogEntryKey].Handle;\r
+  *Handle         = (VOID *)(UINTN)mMeasurementList[LogEntryKey].Handle;\r
   *Token          = mMeasurementList[LogEntryKey].Token;\r
   *Module         = mMeasurementList[LogEntryKey].Module;\r
   *StartTimeStamp = mMeasurementList[LogEntryKey].StartTimeStamp;\r
   *EndTimeStamp   = mMeasurementList[LogEntryKey].EndTimeStamp;\r
   *Identifier     = mMeasurementList[LogEntryKey].Identifier;\r
 \r
-  LogEntryKey ++;\r
+  LogEntryKey++;\r
 \r
   return LogEntryKey;\r
 }\r
@@ -89,24 +89,25 @@ GetPerformanceMeasurementRecord (
 \r
 **/\r
 VOID\r
-GatherStatistics(\r
-  IN OUT PERF_CUM_DATA              *CustomCumulativeData OPTIONAL\r
+GatherStatistics (\r
+  IN OUT PERF_CUM_DATA  *CustomCumulativeData OPTIONAL\r
   )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    Duration;\r
-  UINTN                     LogEntryKey;\r
-  INTN                      TIndex;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              Duration;\r
+  UINTN               LogEntryKey;\r
+  INTN                TIndex;\r
 \r
   LogEntryKey = 0;\r
   while ((LogEntryKey = GetPerformanceMeasurementRecord (\r
-                        LogEntryKey,\r
-                        &Measurement.Handle,\r
-                        &Measurement.Token,\r
-                        &Measurement.Module,\r
-                        &Measurement.StartTimeStamp,\r
-                        &Measurement.EndTimeStamp,\r
-                        &Measurement.Identifier)) != 0)\r
+                          LogEntryKey,\r
+                          &Measurement.Handle,\r
+                          &Measurement.Token,\r
+                          &Measurement.Module,\r
+                          &Measurement.StartTimeStamp,\r
+                          &Measurement.EndTimeStamp,\r
+                          &Measurement.Identifier\r
+                          )) != 0)\r
   {\r
     ++SummaryData.NumTrace;           // Count the number of TRACE Measurement records\r
     if (Measurement.EndTimeStamp == 0) {\r
@@ -118,11 +119,11 @@ GatherStatistics(
       ++SummaryData.NumHandles;       // Count the number of measurements with non-NULL handles\r
     }\r
 \r
-    if (IsPhase&Measurement)) {\r
+    if (IsPhase (&Measurement)) {\r
       ++SummaryData.NumSummary;       // Count the number of major phases\r
-    }\r
-    else {  // !IsPhase\r
-      if(Measurement.Handle == NULL) {\r
+    } else {\r
+      // !IsPhase\r
+      if (Measurement.Handle == NULL) {\r
         ++SummaryData.NumGlobal;\r
       }\r
     }\r
@@ -132,13 +133,14 @@ GatherStatistics(
     }\r
 \r
     Duration = GetDuration (&Measurement);\r
-    TIndex = GetCumulativeItem (&Measurement);\r
+    TIndex   = GetCumulativeItem (&Measurement);\r
     if (TIndex >= 0) {\r
       CumData[TIndex].Duration += Duration;\r
       CumData[TIndex].Count++;\r
       if ( Duration < CumData[TIndex].MinDur ) {\r
         CumData[TIndex].MinDur = Duration;\r
       }\r
+\r
       if ( Duration > CumData[TIndex].MaxDur ) {\r
         CumData[TIndex].MaxDur = Duration;\r
       }\r
@@ -153,6 +155,7 @@ GatherStatistics(
       if (Duration < CustomCumulativeData->MinDur) {\r
         CustomCumulativeData->MinDur = Duration;\r
       }\r
+\r
       if (Duration > CustomCumulativeData->MaxDur) {\r
         CustomCumulativeData->MaxDur = Duration;\r
       }\r
@@ -182,38 +185,43 @@ GatherStatistics(
   @return Others                from a call to gBS->LocateHandleBuffer().\r
 **/\r
 EFI_STATUS\r
-DumpAllTrace(\r
-  IN UINTN             Limit,\r
-  IN BOOLEAN           ExcludeFlag\r
+DumpAllTrace (\r
+  IN UINTN    Limit,\r
+  IN BOOLEAN  ExcludeFlag\r
   )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    ElapsedTime;\r
-  UINT64                    Duration;\r
-  CHAR16                    *IncFlag;\r
-  UINTN                     LogEntryKey;\r
-  UINTN                     Count;\r
-  UINTN                     Index;\r
-  UINTN                     TIndex;\r
-\r
-  EFI_HANDLE                *HandleBuffer;\r
-  UINTN                     HandleCount;\r
-  EFI_STATUS                Status;\r
-  EFI_STRING                StringPtrUnknown;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              ElapsedTime;\r
+  UINT64              Duration;\r
+  CHAR16              *IncFlag;\r
+  UINTN               LogEntryKey;\r
+  UINTN               Count;\r
+  UINTN               Index;\r
+  UINTN               TIndex;\r
+\r
+  EFI_HANDLE  *HandleBuffer;\r
+  UINTN       HandleCount;\r
+  EFI_STATUS  Status;\r
+  EFI_STRING  StringPtrUnknown;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (IncFlag == NULL) ? StringPtrUnknown : IncFlag);\r
+  IncFlag          = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (IncFlag == NULL) ? StringPtrUnknown : IncFlag\r
+    );\r
   FreePool (StringPtrUnknown);\r
 \r
   // Get Handle information\r
   //\r
-  Status  = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);\r
+  Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);\r
   if (EFI_ERROR (Status)) {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);\r
-  }\r
-  else {\r
+  } else {\r
     // We have successfully populated the HandleBuffer\r
     // Display ALL Measurement Records\r
     //    Up to Limit lines displayed\r
@@ -229,35 +237,38 @@ DumpAllTrace(
     }\r
 \r
     LogEntryKey = 0;\r
-    Count = 0;\r
-    Index = 0;\r
-    while ( WITHIN_LIMIT(Count, Limit) &&\r
+    Count       = 0;\r
+    Index       = 0;\r
+    while ( WITHIN_LIMIT (Count, Limit) &&\r
             ((LogEntryKey = GetPerformanceMeasurementRecord (\r
-                            LogEntryKey,\r
-                            &Measurement.Handle,\r
-                            &Measurement.Token,\r
-                            &Measurement.Module,\r
-                            &Measurement.StartTimeStamp,\r
-                            &Measurement.EndTimeStamp,\r
-                            &Measurement.Identifier)) != 0)\r
-          )\r
+                              LogEntryKey,\r
+                              &Measurement.Handle,\r
+                              &Measurement.Token,\r
+                              &Measurement.Module,\r
+                              &Measurement.StartTimeStamp,\r
+                              &Measurement.EndTimeStamp,\r
+                              &Measurement.Identifier\r
+                              )) != 0)\r
+            )\r
     {\r
       ++Index;    // Count every record.  First record is 1.\r
       ElapsedTime = 0;\r
       SHELL_FREE_NON_NULL (IncFlag);\r
       if (Measurement.EndTimeStamp != 0) {\r
-        Duration = GetDuration (&Measurement);\r
-        ElapsedTime = DurationInMicroSeconds ( Duration );\r
-        IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);\r
-      }\r
-      else {\r
+        Duration    = GetDuration (&Measurement);\r
+        ElapsedTime = DurationInMicroSeconds (Duration);\r
+        IncFlag     = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);\r
+      } else {\r
         IncFlag = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL);  // Mark incomplete records\r
       }\r
+\r
       if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||\r
-          ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
-         ) {      // Ignore "uninteresting" or excluded records\r
+          ((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))\r
+          )       // Ignore "uninteresting" or excluded records\r
+      {\r
         continue;\r
       }\r
+\r
       ++Count;    // Count the number of records printed\r
 \r
       // If Handle is non-zero, see if we can determine a name for the driver\r
@@ -279,10 +290,15 @@ DumpAllTrace(
 \r
       // Ensure that the argument strings are not too long.\r
       mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
-      mUnicodeToken[13] = 0;\r
+      mUnicodeToken[13]                    = 0;\r
 \r
       if (mShowId) {\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), mDpHiiHandle,\r
+        ShellPrintHiiEx (\r
+          -1,\r
+          -1,\r
+          NULL,\r
+          STRING_TOKEN (STR_DP_ALL_VARS2),\r
+          mDpHiiHandle,\r
           Index,      // 1 based, Which measurement record is being printed\r
           IncFlag,\r
           Measurement.Handle,\r
@@ -290,26 +306,34 @@ DumpAllTrace(
           mUnicodeToken,\r
           ElapsedTime,\r
           Measurement.Identifier\r
-        );\r
+          );\r
       } else {\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), mDpHiiHandle,\r
+        ShellPrintHiiEx (\r
+          -1,\r
+          -1,\r
+          NULL,\r
+          STRING_TOKEN (STR_DP_ALL_VARS),\r
+          mDpHiiHandle,\r
           Index,      // 1 based, Which measurement record is being printed\r
           IncFlag,\r
           Measurement.Handle,\r
           mGaugeString,\r
           mUnicodeToken,\r
           ElapsedTime\r
-        );\r
+          );\r
       }\r
+\r
       if (ShellGetExecutionBreakFlag ()) {\r
         Status = EFI_ABORTED;\r
         break;\r
       }\r
     }\r
   }\r
+\r
   if (HandleBuffer != NULL) {\r
     FreePool (HandleBuffer);\r
   }\r
+\r
   SHELL_FREE_NON_NULL (IncFlag);\r
 \r
   return Status;\r
@@ -336,28 +360,34 @@ DumpAllTrace(
   @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
 EFI_STATUS\r
-DumpRawTrace(\r
-  IN UINTN          Limit,\r
-  IN BOOLEAN        ExcludeFlag\r
+DumpRawTrace (\r
+  IN UINTN    Limit,\r
+  IN BOOLEAN  ExcludeFlag\r
   )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    ElapsedTime;\r
-  UINT64                    Duration;\r
-  UINTN                     LogEntryKey;\r
-  UINTN                     Count;\r
-  UINTN                     Index;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              ElapsedTime;\r
+  UINT64              Duration;\r
+  UINTN               LogEntryKey;\r
+  UINTN               Count;\r
+  UINTN               Index;\r
 \r
-  EFI_STRING    StringPtr;\r
-  EFI_STRING    StringPtrUnknown;\r
-  EFI_STATUS    Status;\r
+  EFI_STRING  StringPtr;\r
+  EFI_STRING  StringPtrUnknown;\r
+  EFI_STATUS  Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
@@ -370,34 +400,43 @@ DumpRawTrace(
   }\r
 \r
   LogEntryKey = 0;\r
-  Count = 0;\r
-  Index = 0;\r
-  while ( WITHIN_LIMIT(Count, Limit) &&\r
+  Count       = 0;\r
+  Index       = 0;\r
+  while ( WITHIN_LIMIT (Count, Limit) &&\r
           ((LogEntryKey = GetPerformanceMeasurementRecord (\r
-                          LogEntryKey,\r
-                          &Measurement.Handle,\r
-                          &Measurement.Token,\r
-                          &Measurement.Module,\r
-                          &Measurement.StartTimeStamp,\r
-                          &Measurement.EndTimeStamp,\r
-                          &Measurement.Identifier)) != 0)\r
-        )\r
+                            LogEntryKey,\r
+                            &Measurement.Handle,\r
+                            &Measurement.Token,\r
+                            &Measurement.Module,\r
+                            &Measurement.StartTimeStamp,\r
+                            &Measurement.EndTimeStamp,\r
+                            &Measurement.Identifier\r
+                            )) != 0)\r
+          )\r
   {\r
     ++Index;    // Count every record.  First record is 1.\r
     ElapsedTime = 0;\r
     if (Measurement.EndTimeStamp != 0) {\r
-      Duration = GetDuration (&Measurement);\r
-      ElapsedTime = DurationInMicroSeconds ( Duration );\r
+      Duration    = GetDuration (&Measurement);\r
+      ElapsedTime = DurationInMicroSeconds (Duration);\r
     }\r
+\r
     if ((ElapsedTime < mInterestThreshold)                 ||\r
-        ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
-        ) { // Ignore "uninteresting" or Excluded records\r
+        ((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))\r
+        )   // Ignore "uninteresting" or Excluded records\r
+    {\r
       continue;\r
     }\r
+\r
     ++Count;    // Count the number of records printed\r
 \r
     if (mShowId) {\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), mDpHiiHandle,\r
+      ShellPrintHiiEx (\r
+        -1,\r
+        -1,\r
+        NULL,\r
+        STRING_TOKEN (STR_DP_RAW_VARS2),\r
+        mDpHiiHandle,\r
         Index,      // 1 based, Which measurement record is being printed\r
         Measurement.Handle,\r
         Measurement.StartTimeStamp,\r
@@ -405,22 +444,29 @@ DumpRawTrace(
         Measurement.Token,\r
         Measurement.Module,\r
         Measurement.Identifier\r
-      );\r
+        );\r
     } else {\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), mDpHiiHandle,\r
+      ShellPrintHiiEx (\r
+        -1,\r
+        -1,\r
+        NULL,\r
+        STRING_TOKEN (STR_DP_RAW_VARS),\r
+        mDpHiiHandle,\r
         Index,      // 1 based, Which measurement record is being printed\r
         Measurement.Handle,\r
         Measurement.StartTimeStamp,\r
         Measurement.EndTimeStamp,\r
         Measurement.Token,\r
         Measurement.Module\r
-      );\r
+        );\r
     }\r
+\r
     if (ShellGetExecutionBreakFlag ()) {\r
       Status = EFI_ABORTED;\r
       break;\r
     }\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -429,22 +475,22 @@ DumpRawTrace(
 \r
 **/\r
 VOID\r
-ProcessPhases(\r
+ProcessPhases (\r
   VOID\r
   )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    BdsTimeoutValue;\r
-  UINT64                    SecTime;\r
-  UINT64                    PeiTime;\r
-  UINT64                    DxeTime;\r
-  UINT64                    BdsTime;\r
-  UINT64                    ElapsedTime;\r
-  UINT64                    Duration;\r
-  UINT64                    Total;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     LogEntryKey;\r
-  EFI_STRING                StringPtrUnknown;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              BdsTimeoutValue;\r
+  UINT64              SecTime;\r
+  UINT64              PeiTime;\r
+  UINT64              DxeTime;\r
+  UINT64              BdsTime;\r
+  UINT64              ElapsedTime;\r
+  UINT64              Duration;\r
+  UINT64              Total;\r
+  EFI_STRING          StringPtr;\r
+  UINTN               LogEntryKey;\r
+  EFI_STRING          StringPtrUnknown;\r
 \r
   BdsTimeoutValue = 0;\r
   SecTime         = 0;\r
@@ -455,9 +501,15 @@ ProcessPhases(
   // Get Execution Phase Statistics\r
   //\r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
@@ -469,25 +521,28 @@ ProcessPhases(
                           &Measurement.Module,\r
                           &Measurement.StartTimeStamp,\r
                           &Measurement.EndTimeStamp,\r
-                          &Measurement.Identifier)) != 0)\r
+                          &Measurement.Identifier\r
+                          )) != 0)\r
   {\r
-    if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records\r
+    if (Measurement.EndTimeStamp == 0) {\r
+      // Skip "incomplete" records\r
       continue;\r
     }\r
+\r
     Duration = GetDuration (&Measurement);\r
-    if (   Measurement.Handle != NULL\r
-        && (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)\r
-       )\r
+    if (  (Measurement.Handle != NULL)\r
+       && (AsciiStrCmp (Measurement.Token, ALit_BdsTO) == 0)\r
+          )\r
     {\r
       BdsTimeoutValue = Duration;\r
     } else if (AsciiStrCmp (Measurement.Token, ALit_SEC) == 0) {\r
-      SecTime     = Duration;\r
+      SecTime = Duration;\r
     } else if (AsciiStrCmp (Measurement.Token, ALit_PEI) == 0) {\r
-      PeiTime     = Duration;\r
+      PeiTime = Duration;\r
     } else if (AsciiStrCmp (Measurement.Token, ALit_DXE) == 0) {\r
-      DxeTime      = Duration;\r
+      DxeTime = Duration;\r
     } else if (AsciiStrCmp (Measurement.Token, ALit_BDS) == 0) {\r
-      BdsTime      = Duration;\r
+      BdsTime = Duration;\r
     }\r
   }\r
 \r
@@ -496,8 +551,8 @@ ProcessPhases(
   // print SEC phase duration time\r
   //\r
   if (SecTime > 0) {\r
-    ElapsedTime = DurationInMicroSeconds ( SecTime );     // Calculate elapsed time in microseconds\r
-    Total += DivU64x32 (ElapsedTime, 1000);   // Accumulate time in milliseconds\r
+    ElapsedTime = DurationInMicroSeconds (SecTime); // Calculate elapsed time in microseconds\r
+    Total      += DivU64x32 (ElapsedTime, 1000);    // Accumulate time in milliseconds\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), mDpHiiHandle, ElapsedTime);\r
   }\r
 \r
@@ -505,7 +560,7 @@ ProcessPhases(
   //\r
   if (PeiTime > 0) {\r
     ElapsedTime = DivU64x32 (PeiTime, 1000000);\r
-    Total += ElapsedTime;\r
+    Total      += ElapsedTime;\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_PEI, ElapsedTime);\r
   }\r
 \r
@@ -513,7 +568,7 @@ ProcessPhases(
   //\r
   if (DxeTime > 0) {\r
     ElapsedTime = DivU64x32 (DxeTime, 1000000);\r
-    Total += ElapsedTime;\r
+    Total      += ElapsedTime;\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_DXE, ElapsedTime);\r
   }\r
 \r
@@ -521,7 +576,7 @@ ProcessPhases(
   //\r
   if (BdsTime > 0) {\r
     ElapsedTime = DivU64x32 (BdsTime, 1000000);\r
-    Total += ElapsedTime;\r
+    Total      += ElapsedTime;\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_BDS, ElapsedTime);\r
   }\r
 \r
@@ -543,47 +598,53 @@ ProcessPhases(
   @return Others                  from a call to gBS->LocateHandleBuffer().\r
 **/\r
 EFI_STATUS\r
-ProcessHandles(\r
-  IN BOOLEAN      ExcludeFlag\r
+ProcessHandles (\r
+  IN BOOLEAN  ExcludeFlag\r
   )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    ElapsedTime;\r
-  UINT64                    Duration;\r
-  EFI_HANDLE                *HandleBuffer;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     Index;\r
-  UINTN                     LogEntryKey;\r
-  UINTN                     Count;\r
-  UINTN                     HandleCount;\r
-  EFI_STATUS                Status;\r
-  EFI_STRING                StringPtrUnknown;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              ElapsedTime;\r
+  UINT64              Duration;\r
+  EFI_HANDLE          *HandleBuffer;\r
+  EFI_STRING          StringPtr;\r
+  UINTN               Index;\r
+  UINTN               LogEntryKey;\r
+  UINTN               Count;\r
+  UINTN               HandleCount;\r
+  EFI_STATUS          Status;\r
+  EFI_STRING          StringPtrUnknown;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
   Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);\r
   if (EFI_ERROR (Status)) {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mDpHiiHandle, Status);\r
-  }\r
-  else {\r
-#if DP_DEBUG == 2\r
-    Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0])));\r
-#endif\r
+  } else {\r
+ #if DP_DEBUG == 2\r
+    Print (L"There are %,d Handles defined.\n", (Size / sizeof (HandleBuffer[0])));\r
+ #endif\r
 \r
     if (mShowId) {\r
       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION2), mDpHiiHandle);\r
     } else {\r
       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_SECTION), mDpHiiHandle);\r
     }\r
+\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);\r
 \r
     LogEntryKey = 0;\r
-    Count   = 0;\r
+    Count       = 0;\r
     while ((LogEntryKey = GetPerformanceMeasurementRecord (\r
                             LogEntryKey,\r
                             &Measurement.Handle,\r
@@ -591,18 +652,21 @@ ProcessHandles(
                             &Measurement.Module,\r
                             &Measurement.StartTimeStamp,\r
                             &Measurement.EndTimeStamp,\r
-                            &Measurement.Identifier)) != 0)\r
+                            &Measurement.Identifier\r
+                            )) != 0)\r
     {\r
       Count++;\r
-      Duration = GetDuration (&Measurement);\r
-      ElapsedTime = DurationInMicroSeconds ( Duration );\r
+      Duration    = GetDuration (&Measurement);\r
+      ElapsedTime = DurationInMicroSeconds (Duration);\r
       if ((ElapsedTime < mInterestThreshold)                 ||\r
           (Measurement.EndTimeStamp == 0)                    ||\r
           (!IsCorePerf (&Measurement))                       ||\r
-          ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
-         ) { // Ignore "uninteresting" or excluded records\r
+          ((ExcludeFlag) && (GetCumulativeItem (&Measurement) >= 0))\r
+          )  // Ignore "uninteresting" or excluded records\r
+      {\r
         continue;\r
       }\r
+\r
       mGaugeString[0] = 0;    // Empty driver name by default\r
       AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));\r
       // See if the Handle is in the HandleBuffer\r
@@ -612,39 +676,53 @@ ProcessHandles(
           break;\r
         }\r
       }\r
+\r
       // Ensure that the argument strings are not too long.\r
       mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
-      mUnicodeToken[11] = 0;\r
+      mUnicodeToken[11]                    = 0;\r
       if (mGaugeString[0] != 0) {\r
         // Display the record if it has a valid handle.\r
         if (mShowId) {\r
-          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS2), mDpHiiHandle,\r
+          ShellPrintHiiEx (\r
+            -1,\r
+            -1,\r
+            NULL,\r
+            STRING_TOKEN (STR_DP_HANDLE_VARS2),\r
+            mDpHiiHandle,\r
             Count,      // 1 based, Which measurement record is being printed\r
             Index + 1,  // 1 based, Which handle is being printed\r
             mGaugeString,\r
             mUnicodeToken,\r
             ElapsedTime,\r
             Measurement.Identifier\r
-          );\r
+            );\r
         } else {\r
-          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS), mDpHiiHandle,\r
+          ShellPrintHiiEx (\r
+            -1,\r
+            -1,\r
+            NULL,\r
+            STRING_TOKEN (STR_DP_HANDLE_VARS),\r
+            mDpHiiHandle,\r
             Count,      // 1 based, Which measurement record is being printed\r
             Index + 1,  // 1 based, Which handle is being printed\r
             mGaugeString,\r
             mUnicodeToken,\r
             ElapsedTime\r
-          );\r
+            );\r
         }\r
       }\r
+\r
       if (ShellGetExecutionBreakFlag ()) {\r
         Status = EFI_ABORTED;\r
         break;\r
       }\r
     }\r
   }\r
+\r
   if (HandleBuffer != NULL) {\r
     FreePool (HandleBuffer);\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -657,25 +735,31 @@ ProcessHandles(
   @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
 EFI_STATUS\r
-ProcessPeims(\r
+ProcessPeims (\r
   VOID\r
-)\r
+  )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    Duration;\r
-  UINT64                    ElapsedTime;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     LogEntryKey;\r
-  UINTN                     TIndex;\r
-  EFI_STRING                StringPtrUnknown;\r
-  EFI_STATUS                Status;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              Duration;\r
+  UINT64              ElapsedTime;\r
+  EFI_STRING          StringPtr;\r
+  UINTN               LogEntryKey;\r
+  UINTN               TIndex;\r
+  EFI_STRING          StringPtrUnknown;\r
+  EFI_STATUS          Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
@@ -684,8 +768,9 @@ ProcessPeims(
   } else {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDpHiiHandle);\r
   }\r
+\r
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);\r
-  TIndex  = 0;\r
+  TIndex      = 0;\r
   LogEntryKey = 0;\r
   while ((LogEntryKey = GetPerformanceMeasurementRecord (\r
                           LogEntryKey,\r
@@ -694,39 +779,53 @@ ProcessPeims(
                           &Measurement.Module,\r
                           &Measurement.StartTimeStamp,\r
                           &Measurement.EndTimeStamp,\r
-                          &Measurement.Identifier)) != 0)\r
+                          &Measurement.Identifier\r
+                          )) != 0)\r
   {\r
     TIndex++;\r
     if ((Measurement.EndTimeStamp == 0) ||\r
         (AsciiStrCmp (Measurement.Token, ALit_PEIM) != 0)\r
-       ) {\r
+        )\r
+    {\r
       continue;\r
     }\r
 \r
-    Duration = GetDuration (&Measurement);\r
-    ElapsedTime = DurationInMicroSeconds ( Duration );  // Calculate elapsed time in microseconds\r
+    Duration    = GetDuration (&Measurement);\r
+    ElapsedTime = DurationInMicroSeconds (Duration);    // Calculate elapsed time in microseconds\r
     if (ElapsedTime >= mInterestThreshold) {\r
       // PEIM FILE Handle is the start address of its FFS file that contains its file guid.\r
       if (mShowId) {\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), mDpHiiHandle,\r
-              TIndex,   // 1 based, Which measurement record is being printed\r
-              Measurement.Handle,  // file guid\r
-              ElapsedTime,\r
-              Measurement.Identifier\r
-        );\r
+        ShellPrintHiiEx (\r
+          -1,\r
+          -1,\r
+          NULL,\r
+          STRING_TOKEN (STR_DP_PEIM_VARS2),\r
+          mDpHiiHandle,\r
+          TIndex,             // 1 based, Which measurement record is being printed\r
+          Measurement.Handle, // file guid\r
+          ElapsedTime,\r
+          Measurement.Identifier\r
+          );\r
       } else {\r
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), mDpHiiHandle,\r
-              TIndex,   // 1 based, Which measurement record is being printed\r
-              Measurement.Handle,  // file guid\r
-              ElapsedTime\r
-        );\r
+        ShellPrintHiiEx (\r
+          -1,\r
+          -1,\r
+          NULL,\r
+          STRING_TOKEN (STR_DP_PEIM_VARS),\r
+          mDpHiiHandle,\r
+          TIndex,             // 1 based, Which measurement record is being printed\r
+          Measurement.Handle, // file guid\r
+          ElapsedTime\r
+          );\r
       }\r
     }\r
+\r
     if (ShellGetExecutionBreakFlag ()) {\r
       Status = EFI_ABORTED;\r
       break;\r
     }\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -742,25 +841,31 @@ ProcessPeims(
   @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
 EFI_STATUS\r
-ProcessGlobal(\r
+ProcessGlobal (\r
   VOID\r
-)\r
+  )\r
 {\r
-  MEASUREMENT_RECORD        Measurement;\r
-  UINT64                    Duration;\r
-  UINT64                    ElapsedTime;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     LogEntryKey;\r
-  UINTN                     Index;        // Index, or number, of the measurement record being processed\r
-  EFI_STRING                StringPtrUnknown;\r
-  EFI_STATUS                Status;\r
+  MEASUREMENT_RECORD  Measurement;\r
+  UINT64              Duration;\r
+  UINT64              ElapsedTime;\r
+  EFI_STRING          StringPtr;\r
+  UINTN               LogEntryKey;\r
+  UINTN               Index;              // Index, or number, of the measurement record being processed\r
+  EFI_STRING          StringPtrUnknown;\r
+  EFI_STATUS          Status;\r
 \r
   Status = EFI_SUCCESS;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
@@ -769,9 +874,10 @@ ProcessGlobal(
   } else {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), mDpHiiHandle);\r
   }\r
+\r
   ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandle);\r
 \r
-  Index = 1;\r
+  Index       = 1;\r
   LogEntryKey = 0;\r
 \r
   while ((LogEntryKey = GetPerformanceMeasurementRecord (\r
@@ -781,22 +887,28 @@ ProcessGlobal(
                           &Measurement.Module,\r
                           &Measurement.StartTimeStamp,\r
                           &Measurement.EndTimeStamp,\r
-                          &Measurement.Identifier)) != 0)\r
+                          &Measurement.Identifier\r
+                          )) != 0)\r
   {\r
     AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString));\r
     AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));\r
-    mGaugeString[25] = 0;\r
+    mGaugeString[25]  = 0;\r
     mUnicodeToken[31] = 0;\r
-    if ( ! ( IsPhase( &Measurement)  ||\r
-        IsCorePerf (&Measurement)      ||\r
-        (Measurement.EndTimeStamp == 0)\r
-        ))\r
+    if ( !(IsPhase (&Measurement)  ||\r
+           IsCorePerf (&Measurement)      ||\r
+           (Measurement.EndTimeStamp == 0)\r
+           ))\r
     {\r
-      Duration = GetDuration (&Measurement);\r
-      ElapsedTime = DurationInMicroSeconds ( Duration );\r
+      Duration    = GetDuration (&Measurement);\r
+      ElapsedTime = DurationInMicroSeconds (Duration);\r
       if (ElapsedTime >= mInterestThreshold) {\r
         if (mShowId) {\r
-          ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS2), mDpHiiHandle,\r
+          ShellPrintHiiEx (\r
+            -1,\r
+            -1,\r
+            NULL,\r
+            STRING_TOKEN (STR_DP_GLOBAL_VARS2),\r
+            mDpHiiHandle,\r
             Index,\r
             mGaugeString,\r
             mUnicodeToken,\r
@@ -804,7 +916,12 @@ ProcessGlobal(
             Measurement.Identifier\r
             );\r
         } else {\r
-           ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS), mDpHiiHandle,\r
+          ShellPrintHiiEx (\r
+            -1,\r
+            -1,\r
+            NULL,\r
+            STRING_TOKEN (STR_DP_GLOBAL_VARS),\r
+            mDpHiiHandle,\r
             Index,\r
             mGaugeString,\r
             mUnicodeToken,\r
@@ -813,12 +930,15 @@ ProcessGlobal(
         }\r
       }\r
     }\r
+\r
     if (ShellGetExecutionBreakFlag ()) {\r
       Status = EFI_ABORTED;\r
       break;\r
     }\r
+\r
     Index++;\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -834,22 +954,28 @@ ProcessGlobal(
 \r
 **/\r
 VOID\r
-ProcessCumulative(\r
-  IN PERF_CUM_DATA                  *CustomCumulativeData OPTIONAL\r
+ProcessCumulative (\r
+  IN PERF_CUM_DATA  *CustomCumulativeData OPTIONAL\r
   )\r
 {\r
-  UINT64                    AvgDur;         // the computed average duration\r
-  UINT64                    Dur;\r
-  UINT64                    MinDur;\r
-  UINT64                    MaxDur;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     TIndex;\r
-  EFI_STRING                StringPtrUnknown;\r
+  UINT64      AvgDur;                       // the computed average duration\r
+  UINT64      Dur;\r
+  UINT64      MinDur;\r
+  UINT64      MaxDur;\r
+  EFI_STRING  StringPtr;\r
+  UINTN       TIndex;\r
+  EFI_STRING  StringPtrUnknown;\r
 \r
   StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
-  StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);\r
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
-              (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
+  StringPtr        = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);\r
+  ShellPrintHiiEx (\r
+    -1,\r
+    -1,\r
+    NULL,\r
+    STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+    mDpHiiHandle,\r
+    (StringPtr == NULL) ? StringPtrUnknown : StringPtr\r
+    );\r
   FreePool (StringPtr);\r
   FreePool (StringPtrUnknown);\r
 \r
@@ -860,19 +986,24 @@ ProcessCumulative(
   for ( TIndex = 0; TIndex < NumCum; ++TIndex) {\r
     if (CumData[TIndex].Count != 0) {\r
       AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);\r
-      AvgDur = DurationInMicroSeconds(AvgDur);\r
-      Dur    = DurationInMicroSeconds(CumData[TIndex].Duration);\r
-      MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur);\r
-      MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur);\r
-\r
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,\r
-                  CumData[TIndex].Name,\r
-                  CumData[TIndex].Count,\r
-                  Dur,\r
-                  AvgDur,\r
-                  MinDur,\r
-                  MaxDur\r
-                 );\r
+      AvgDur = DurationInMicroSeconds (AvgDur);\r
+      Dur    = DurationInMicroSeconds (CumData[TIndex].Duration);\r
+      MaxDur = DurationInMicroSeconds (CumData[TIndex].MaxDur);\r
+      MinDur = DurationInMicroSeconds (CumData[TIndex].MinDur);\r
+\r
+      ShellPrintHiiEx (\r
+        -1,\r
+        -1,\r
+        NULL,\r
+        STRING_TOKEN (STR_DP_CUMULATIVE_STATS),\r
+        mDpHiiHandle,\r
+        CumData[TIndex].Name,\r
+        CumData[TIndex].Count,\r
+        Dur,\r
+        AvgDur,\r
+        MinDur,\r
+        MaxDur\r
+        );\r
     }\r
   }\r
 \r
@@ -892,13 +1023,19 @@ ProcessCumulative(
       MaxDur = 0;\r
       MinDur = 0;\r
     }\r
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CUMULATIVE_STATS), mDpHiiHandle,\r
-                CustomCumulativeData->Name,\r
-                CustomCumulativeData->Count,\r
-                Dur,\r
-                AvgDur,\r
-                MinDur,\r
-                MaxDur\r
-                );\r
+\r
+    ShellPrintHiiEx (\r
+      -1,\r
+      -1,\r
+      NULL,\r
+      STRING_TOKEN (STR_DP_CUMULATIVE_STATS),\r
+      mDpHiiHandle,\r
+      CustomCumulativeData->Name,\r
+      CustomCumulativeData->Count,\r
+      Dur,\r
+      AvgDur,\r
+      MinDur,\r
+      MaxDur\r
+      );\r
   }\r
 }\r