]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Library / BasePerformanceLibNull / PerformanceLib.c
index e35235d9a29228b5554b88dd85f2531d2e562610..76a0c73c475efda16dafa93abe97d774bc02b441 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Base Performance Library which provides no service.\r
 \r
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2018, 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
@@ -21,8 +21,8 @@
 #include <Library/PcdLib.h>\r
 \r
 /**\r
-  Creates a record for the beginning of a performance measurement. \r
-  \r
+  Creates a record for the beginning of a performance measurement.\r
+\r
   Creates a record that contains the Handle, Token, and Module.\r
   If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
   If TimeStamp is zero, then this function reads the current time stamp\r
@@ -54,8 +54,8 @@ StartPerformanceMeasurement (
 }\r
 \r
 /**\r
-  Fills in the end time of a performance measurement. \r
-  \r
+  Fills in the end time of a performance measurement.\r
+\r
   Looks up the record that matches Handle, Token, and Module.\r
   If the record can not be found then return RETURN_NOT_FOUND.\r
   If the record is found and TimeStamp is not zero,\r
@@ -89,7 +89,7 @@ EndPerformanceMeasurement (
 }\r
 \r
 /**\r
-  Attempts to retrieve a performance measurement log entry from the performance measurement log. \r
+  Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
   It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,\r
   and then eliminate the Identifier.\r
 \r
@@ -114,9 +114,9 @@ EndPerformanceMeasurement (
                                   0, then the first performance measurement log entry is retrieved.\r
                                   On exit, the key of the next performance lof entry entry.\r
   @param  Handle                  The pointer to environment specific context used to identify the component\r
-                                  being measured.  \r
+                                  being measured.\r
   @param  Token                   The pointer to a Null-terminated ASCII string that identifies the component\r
-                                  being measured. \r
+                                  being measured.\r
   @param  Module                  The pointer to a Null-terminated ASCII string that identifies the module\r
                                   being measured.\r
   @param  StartTimeStamp          The pointer to the 64-bit time stamp that was recorded when the measurement\r
@@ -130,7 +130,7 @@ EndPerformanceMeasurement (
 UINTN\r
 EFIAPI\r
 GetPerformanceMeasurement (\r
-  IN  UINTN       LogEntryKey, \r
+  IN  UINTN       LogEntryKey,\r
   OUT CONST VOID  **Handle,\r
   OUT CONST CHAR8 **Token,\r
   OUT CONST CHAR8 **Module,\r
@@ -265,7 +265,7 @@ EndPerformanceMeasurementEx (
 UINTN\r
 EFIAPI\r
 GetPerformanceMeasurementEx (\r
-  IN  UINTN       LogEntryKey, \r
+  IN  UINTN       LogEntryKey,\r
   OUT CONST VOID  **Handle,\r
   OUT CONST CHAR8 **Token,\r
   OUT CONST CHAR8 **Module,\r
@@ -285,8 +285,8 @@ GetPerformanceMeasurementEx (
 }\r
 \r
 /**\r
-  Returns TRUE if the performance measurement macros are enabled. \r
-  \r
+  Returns TRUE if the performance measurement macros are enabled.\r
+\r
   This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
   PcdPerformanceLibraryPropertyMask is set.  Otherwise FALSE is returned.\r
 \r
@@ -304,3 +304,58 @@ PerformanceMeasurementEnabled (
 {\r
   return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
 }\r
+\r
+/**\r
+  Create performance record with event description and a timestamp.\r
+\r
+  @param CallerIdentifier  - Image handle or pointer to caller ID GUID\r
+  @param Guid              - Pointer to a GUID\r
+  @param String            - Pointer to a string describing the measurement\r
+  @param Address           - Pointer to a location in memory relevant to the measurement\r
+  @param Identifier        - Performance identifier describing the type of measurement\r
+\r
+  @retval RETURN_SUCCESS           - Successfully created performance record\r
+  @retval RETURN_OUT_OF_RESOURCES  - Ran out of space to store the records\r
+  @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL\r
+                                     pointer or invalid PerfId\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+LogPerformanceMeasurement (\r
+  IN CONST VOID   *CallerIdentifier,OPTIONAL\r
+  IN CONST VOID   *Guid,    OPTIONAL\r
+  IN CONST CHAR8  *String,  OPTIONAL\r
+  IN UINT64       Address,  OPTIONAL\r
+  IN UINT32       Identifier\r
+  )\r
+{\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+  Check whether the specified performance measurement can be logged.\r
+\r
+  This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set\r
+  and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.\r
+\r
+  @param Type        - Type of the performance measurement entry.\r
+\r
+  @retval TRUE         The performance measurement can be logged.\r
+  @retval FALSE        The performance measurement can NOT be logged.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+LogPerformanceMeasurementEnabled (\r
+  IN  CONST UINTN        Type\r
+  )\r
+{\r
+  //\r
+  // When Performance measurement is enabled and the type is not filtered, the performance can be logged.\r
+  //\r
+  if (PerformanceMeasurementEnabled () && (PcdGet8(PcdPerformanceLibraryPropertyMask) & Type) == 0) {\r
+    return TRUE;\r
+  }\r
+  return FALSE;\r
+}\r