]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PerformancePkg/Dp_App: Support execution break
authorCinnamon Shia <cinnamon.shia@hpe.com>
Mon, 7 Mar 2016 03:23:07 +0000 (11:23 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 8 Mar 2016 10:23:49 +0000 (18:23 +0800)
Support UEFI shell execution break.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Samer EL-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
PerformancePkg/Dp_App/Dp.c
PerformancePkg/Dp_App/DpInternal.h
PerformancePkg/Dp_App/DpTrace.c

index e05221699cf2a00ff214625e6461f8f90f74acc9..e36a03209187ccbc174767ce757338f78046ea68 100644 (file)
@@ -14,7 +14,7 @@
   timer information to calculate elapsed time for each measurement.\r
  \r
   Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -195,11 +195,11 @@ InitCumulativeData (
   \r
   @param[in]  ImageHandle     The image handle.\r
   @param[in]  SystemTable     The system table.\r
-  \r
+\r
   @retval EFI_SUCCESS            Command completed successfully.\r
   @retval EFI_INVALID_PARAMETER  Command usage error.\r
+  @retval EFI_ABORTED            The user aborts the operation.\r
   @retval value                  Unknown error.\r
-  \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -443,7 +443,10 @@ InitializeDp (
         ProcessCumulative (CustomCumulativeData);\r
       } else if (AllMode) {\r
         if (TraceMode) {\r
-          DumpAllTrace( Number2Display, ExcludeMode);\r
+          Status = DumpAllTrace( Number2Display, ExcludeMode);\r
+          if (Status == EFI_ABORTED) {\r
+            goto Done;\r
+          }\r
         }\r
         if (ProfileMode) {\r
           DumpAllProfile( Number2Display, ExcludeMode);\r
@@ -451,7 +454,10 @@ InitializeDp (
       }\r
       else if (RawMode) {\r
         if (TraceMode) {\r
-          DumpRawTrace( Number2Display, ExcludeMode);\r
+          Status = DumpRawTrace( Number2Display, ExcludeMode);\r
+          if (Status == EFI_ABORTED) {\r
+            goto Done;\r
+          }\r
         }\r
         if (ProfileMode) {\r
           DumpRawProfile( Number2Display, ExcludeMode);\r
@@ -463,11 +469,21 @@ InitializeDp (
           ProcessPhases ( Ticker );\r
           if ( ! SummaryMode) {\r
             Status = ProcessHandles ( ExcludeMode);\r
-            if ( ! EFI_ERROR( Status)) {\r
-              ProcessPeims (     );\r
-              ProcessGlobal (    );\r
-              ProcessCumulative (NULL);\r
+            if (Status == EFI_ABORTED) {\r
+              goto Done;\r
             }\r
+\r
+            Status = ProcessPeims ();\r
+            if (Status == EFI_ABORTED) {\r
+              goto Done;\r
+            }\r
+\r
+            Status = ProcessGlobal ();\r
+            if (Status == EFI_ABORTED) {\r
+              goto Done;\r
+            }\r
+\r
+            ProcessCumulative (NULL);\r
           }\r
         }\r
         if (ProfileMode) {\r
@@ -480,6 +496,8 @@ InitializeDp (
     }\r
   }\r
 \r
+Done:\r
+\r
   //\r
   // Free the memory allocate from HiiGetString\r
   //\r
index 0e97e1e17d04c02fc76933cf42765118ef7f752b..53c5fb201ae841cd83b72a120a250933f03b7074 100644 (file)
@@ -7,7 +7,7 @@
   DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
 \r
   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -215,8 +215,11 @@ GatherStatistics(
   @param[in]    Limit       The number of records to print.  Zero is ALL.\r
   @param[in]    ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
   \r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
+  @return Others                from a call to gBS->LocateHandleBuffer().\r
 **/\r
-VOID\r
+EFI_STATUS\r
 DumpAllTrace(\r
   IN UINTN             Limit,\r
   IN BOOLEAN           ExcludeFlag\r
@@ -238,9 +241,11 @@ DumpAllTrace(
   \r
   @param[in]    Limit       The number of records to print.  Zero is ALL.\r
   @param[in]    ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-  \r
+\r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 DumpRawTrace(\r
   IN UINTN          Limit,\r
   IN BOOLEAN        ExcludeFlag\r
@@ -262,8 +267,10 @@ ProcessPhases(
   Gather and print Handle data.\r
   \r
   @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.\r
-  \r
-  @return       Status from a call to gBS->LocateHandle().\r
+\r
+  @retval EFI_SUCCESS             The operation was successful.\r
+  @retval EFI_ABORTED             The user aborts the operation.\r
+  @return Others                  from a call to gBS->LocateHandleBuffer().\r
 **/\r
 EFI_STATUS\r
 ProcessHandles(\r
@@ -276,8 +283,10 @@ ProcessHandles(
   \r
   Only prints complete PEIM records\r
   \r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 ProcessPeims(\r
   VOID\r
   );\r
@@ -290,8 +299,10 @@ ProcessPeims(
   Increment TIndex for every record, even skipped ones, so that we have an\r
   indication of every measurement record taken.\r
   \r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 ProcessGlobal(\r
   VOID\r
   );\r
index 632904f339408145aa2ac8a91610864ef4cb97aa..fc21cdc7078a2214d4fc3a3a427becf18e22ba5f 100644 (file)
@@ -136,8 +136,11 @@ GatherStatistics(
   @param[in]    Limit       The number of records to print.  Zero is ALL.\r
   @param[in]    ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
   \r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
+  @return Others                from a call to gBS->LocateHandleBuffer().\r
 **/\r
-VOID\r
+EFI_STATUS\r
 DumpAllTrace(\r
   IN UINTN             Limit,\r
   IN BOOLEAN           ExcludeFlag\r
@@ -257,12 +260,17 @@ DumpAllTrace(
           ElapsedTime\r
         );\r
       }\r
+      if (ShellGetExecutionBreakFlag ()) {\r
+        Status = EFI_ABORTED;\r
+        break;\r
+      }\r
     }\r
   }\r
   if (HandleBuffer != NULL) {\r
     FreePool (HandleBuffer);\r
   }\r
   SafeFreePool ((VOID *) IncFlag);\r
+  return Status;\r
 }\r
 \r
 /** \r
@@ -281,9 +289,11 @@ DumpAllTrace(
   \r
   @param[in]    Limit       The number of records to print.  Zero is ALL.\r
   @param[in]    ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-  \r
+\r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 DumpRawTrace(\r
   IN UINTN          Limit,\r
   IN BOOLEAN        ExcludeFlag\r
@@ -298,6 +308,9 @@ DumpRawTrace(
 \r
   EFI_STRING    StringPtr;\r
   EFI_STRING    StringPtrUnknown;\r
+  EFI_STATUS    Status;\r
+\r
+  Status = EFI_SUCCESS;\r
 \r
   StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);  \r
   StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);\r
@@ -361,7 +374,12 @@ DumpRawTrace(
         Measurement.Module\r
       );\r
     }\r
+    if (ShellGetExecutionBreakFlag ()) {\r
+      Status = EFI_ABORTED;\r
+      break;\r
+    }\r
   }\r
+  return Status;\r
 }\r
 \r
 /** \r
@@ -509,8 +527,10 @@ ProcessPhases(
   Gather and print Handle data.\r
   \r
   @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.\r
-  \r
-  @return       Status from a call to gBS->LocateHandle().\r
+\r
+  @retval EFI_SUCCESS             The operation was successful.\r
+  @retval EFI_ABORTED             The user aborts the operation.\r
+  @return Others                  from a call to gBS->LocateHandleBuffer().\r
 **/\r
 EFI_STATUS\r
 ProcessHandles(\r
@@ -608,6 +628,10 @@ ProcessHandles(
           );\r
         }\r
       }\r
+      if (ShellGetExecutionBreakFlag ()) {\r
+        Status = EFI_ABORTED;\r
+        break;\r
+      }\r
     }\r
   }\r
   if (HandleBuffer != NULL) {\r
@@ -620,9 +644,11 @@ ProcessHandles(
   Gather and print PEIM data.\r
   \r
   Only prints complete PEIM records\r
-  \r
+\r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 ProcessPeims(\r
   VOID\r
 )\r
@@ -634,6 +660,9 @@ ProcessPeims(
   UINTN                     LogEntryKey;\r
   UINTN                     TIndex;\r
   EFI_STRING                StringPtrUnknown;\r
+  EFI_STATUS                Status;\r
+\r
+  Status = EFI_SUCCESS;\r
 \r
   StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);  \r
   StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);\r
@@ -687,7 +716,12 @@ ProcessPeims(
         );\r
       }\r
     }\r
+    if (ShellGetExecutionBreakFlag ()) {\r
+      Status = EFI_ABORTED;\r
+      break;\r
+    }\r
   }\r
+  return Status;\r
 }\r
 \r
 /** \r
@@ -697,9 +731,11 @@ ProcessPeims(
   Only prints records where Handle is NULL\r
   Increment TIndex for every record, even skipped ones, so that we have an\r
   indication of every measurement record taken.\r
-  \r
+\r
+  @retval EFI_SUCCESS           The operation was successful.\r
+  @retval EFI_ABORTED           The user aborts the operation.\r
 **/\r
-VOID\r
+EFI_STATUS\r
 ProcessGlobal(\r
   VOID\r
 )\r
@@ -711,6 +747,9 @@ ProcessGlobal(
   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 (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);  \r
   StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);\r
@@ -770,8 +809,13 @@ ProcessGlobal(
         }\r
       }\r
     }\r
+    if (ShellGetExecutionBreakFlag ()) {\r
+      Status = EFI_ABORTED;\r
+      break;\r
+    }\r
     Index++;\r
   }\r
+  return Status;\r
 }\r
 \r
 /** \r