]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PerformancePkg/Dp_App/DpInternal.h
BaseTools: Update Python Makefile to include the new added python files
[mirror_edk2.git] / PerformancePkg / Dp_App / DpInternal.h
index 974901203ac26f6430b3dd865a11958ea7f46d38..1ab36ba7ede9d3ad5c40a47e7dde25f9b232bae1 100644 (file)
@@ -1,30 +1,35 @@
 /** @file\r
-  * Declarations of objects defined internally to the Dp Application.\r
-  *\r
-  * Declarations of data and functions which are private to the Dp application.\r
-  * This file should never be referenced by anything other than components of the\r
-  * Dp application.  In addition to global data, function declarations for\r
-  * DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
-  *\r
-  * Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<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
-  * http://opensource.org/licenses/bsd-license.php\r
-  *\r
-  * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Declarations of objects defined internally to the Dp Application.\r
+\r
+  Declarations of data and functions which are private to the Dp application.\r
+  This file should never be referenced by anything other than components of the\r
+  Dp application.  In addition to global data, function declarations for\r
+  DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
+\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 **/\r
 #ifndef _DP_INTELNAL_H_\r
 #define _DP_INTELNAL_H_\r
+\r
+#define DP_GAUGE_STRING_LENGTH   36\r
+\r
 //\r
 /// Module-Global Variables\r
 ///@{\r
 extern EFI_HII_HANDLE     gHiiHandle;\r
 extern CHAR16             *mPrintTokenBuffer;\r
-extern CHAR16             mGaugeString[DXE_PERFORMANCE_STRING_SIZE];\r
-extern CHAR16             mUnicodeToken[PERF_TOKEN_LENGTH + 1];\r
+extern CHAR16             mGaugeString[DP_GAUGE_STRING_LENGTH + 1];\r
+extern CHAR16             mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];\r
 extern UINT64             mInterestThreshold;\r
+extern BOOLEAN            mShowId;\r
 \r
 extern PERF_SUMMARY_DATA  SummaryData;    ///< Create the SummaryData structure and init. to ZERO.\r
 \r
@@ -62,7 +67,7 @@ extern UINT32 const       NumCum;
 UINT64\r
 GetDuration (\r
   IN OUT MEASUREMENT_RECORD *Measurement\r
-);\r
+  );\r
 \r
 /** \r
   Determine whether the Measurement record is for an EFI Phase.\r
@@ -78,7 +83,7 @@ GetDuration (
 BOOLEAN\r
 IsPhase(\r
   IN MEASUREMENT_RECORD *Measurement\r
-);\r
+  );\r
 \r
 /** \r
   Get the file name portion of the Pdb File Name.\r
@@ -96,10 +101,17 @@ VOID
 GetShortPdbFileName (\r
   IN  CHAR8     *PdbFileName,\r
   OUT CHAR16    *UnicodeBuffer\r
-);\r
+  );\r
 \r
 /** \r
   Get a human readable name for an image handle.\r
+  The following methods will be tried orderly:\r
+    1. Image PDB\r
+    2. ComponentName2 protocol\r
+    3. FFS UI section\r
+    4. Image GUID\r
+    5. Image DevicePath\r
+    6. Unknown Driver Name\r
   \r
   @param[in]    Handle\r
   \r
@@ -110,7 +122,7 @@ GetShortPdbFileName (
 VOID\r
 GetNameFromHandle (\r
   IN EFI_HANDLE Handle\r
-);\r
+  );\r
 \r
 /** \r
   Calculate the Duration in microseconds.\r
@@ -128,7 +140,7 @@ GetNameFromHandle (
 UINT64\r
 DurationInMicroSeconds (\r
   IN UINT64 Duration\r
-);\r
+  );\r
 \r
 /** \r
   Formatted Print using a Hii Token to reference the localized format string.\r
@@ -140,10 +152,11 @@ DurationInMicroSeconds (
   \r
 **/\r
 UINTN\r
+EFIAPI\r
 PrintToken (\r
   IN UINT16 Token,\r
   ...\r
-);\r
+  );\r
 \r
 /** \r
   Get index of Measurement Record's match in the CumData array.\r
@@ -161,7 +174,7 @@ PrintToken (
 INTN\r
 GetCumulativeItem(\r
   IN MEASUREMENT_RECORD *Measurement\r
-);\r
+  );\r
 \r
 /** \r
   Collect verbose statistics about the logged performance measurements.\r
@@ -176,11 +189,14 @@ GetCumulativeItem(
   \r
   @post The SummaryData and CumData structures contain statistics for the\r
         current performance logs.\r
+\r
+  @param[in, out] CustomCumulativeData  The pointer to the custom cumulative data.\r
+\r
 **/\r
 VOID\r
 GatherStatistics(\r
-  VOID\r
-);\r
+  IN OUT PERF_CUM_DATA              *CustomCumulativeData OPTIONAL\r
+  );\r
 \r
 /** \r
   Gather and print ALL Trace Records.\r
@@ -199,12 +215,15 @@ 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
-);\r
+  );\r
 \r
 /** \r
   Gather and print Raw Trace Records.\r
@@ -222,37 +241,39 @@ 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
-);\r
+  );\r
 \r
 /** \r
   Gather and print Major Phase metrics.\r
   \r
-  @param[in]    Ticker      The timer value for the END of Shell phase\r
-  \r
 **/\r
 VOID\r
 ProcessPhases(\r
-  IN UINT64 Ticker\r
-);\r
+  VOID\r
+  );\r
 \r
 \r
 /** \r
   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
   IN BOOLEAN ExcludeFlag\r
-);\r
+  );\r
 \r
 \r
 /** \r
@@ -260,11 +281,13 @@ 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
+  );\r
 \r
 /** \r
   Gather and print global data.\r
@@ -274,11 +297,13 @@ 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
+  );\r
 \r
 /** \r
   Gather and print cumulative data.\r
@@ -287,12 +312,14 @@ ProcessGlobal(
   For each record with a Token listed in the CumData array:<BR>\r
      - Update the instance count and the total, minimum, and maximum durations.\r
   Finally, print the gathered cumulative statistics.\r
+\r
+  @param[in]    CustomCumulativeData  The pointer to the custom cumulative data.\r
   \r
 **/\r
 VOID\r
 ProcessCumulative(\r
-  VOID\r
-);\r
+  IN PERF_CUM_DATA                  *CustomCumulativeData OPTIONAL\r
+  );\r
 \r
 /** \r
   Gather and print ALL Profiling Records.\r
@@ -316,7 +343,7 @@ VOID
 DumpAllProfile(\r
   IN UINTN          Limit,\r
   IN BOOLEAN        ExcludeFlag\r
-);\r
+  );\r
 \r
 /** \r
   Gather and print Raw Profile Records.\r
@@ -340,5 +367,17 @@ VOID
 DumpRawProfile(\r
   IN UINTN          Limit,\r
   IN BOOLEAN        ExcludeFlag\r
-);\r
+  );\r
+\r
+/**\r
+  Wrap original FreePool to check NULL pointer first.\r
+\r
+  @param[in]    Buffer      The pointer to the buffer to free.\r
+\r
+**/\r
+VOID\r
+SafeFreePool (\r
+  IN VOID   *Buffer\r
+  );\r
+\r
 #endif\r