]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/PerformanceLib.h
Synchronization of MDE Library Spec., Mde.dec, and corresponding head files in MdePkg...
[mirror_edk2.git] / MdePkg / Include / Library / PerformanceLib.h
index 36564095e9ec5cd9ec7e78cd11d43cde6e528c2b..0622527e7bdeeedbbb5dfefb536b7cbf9b3044ab 100644 (file)
@@ -1,25 +1,23 @@
 /** @file\r
-  Library that provides services to measure module execution performance\r
+  Provides services to log the execution times and retrieve them later.\r
 \r
-  Copyright (c) 2004, Intel Corporation                                                         \r
-  All rights reserved. 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
+Copyright (c) 2006 - 2008 Intel Corporation.\r
+All rights reserved. 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
-  Module Name:  PerformanceLib.h\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
 **/\r
 \r
 #ifndef __PERFORMANCE_LIB_H__\r
 #define __PERFORMANCE_LIB_H__\r
 \r
-//\r
-// Performance library propery mask bits\r
-//\r
+///\r
+/// Performance library propery mask bits\r
+///\r
 #define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED  0x00000001\r
 \r
 /**\r
@@ -84,31 +82,46 @@ EndPerformanceMeasurement (
   );\r
 \r
 /**\r
-  Retrieves a previously logged performance measurement\r
+  Attempts to retrieve a performance measurement log entry from the performance measurement log\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 then the start of the measurement is returned in StartTimeStamp,\r
-  and the end of the measurement is returned in EndTimeStamp.\r
-\r
-  @param  LogEntryKey             The key for the previous performance measurement log entry.\r
-                                  If 0, then the first performance measurement log entry is retrieved.\r
-  @param  Handle                  Pointer to environment specific context used\r
-                                  to identify the component being measured.\r
-  @param  Token                   Pointer to a Null-terminated ASCII string\r
-                                  that identifies the component being measured.\r
-  @param  Module                  Pointer to a Null-terminated ASCII string\r
-                                  that identifies the module being measured.\r
-  @param  StartTimeStamp          The 64-bit time stamp that was recorded when the measurement was started.\r
-  @param  EndTimeStamp            The 64-bit time stamp that was recorded when the measurement was ended.\r
-\r
-  @return The key for the current performance log entry.\r
+  Attempts to retrieve the performance log entry specified by LogEntryKey.  If LogEntryKey is\r
+  zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
+  and the key for the second entry in the log is returned.  If the performance log is empty,\r
+  then no entry is retrieved and zero is returned.  If LogEntryKey is not zero, then the performance\r
+  log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
+  returned.  If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
+  retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
+  log is returned.  If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
+  is retrieved and zero is returned.  In the cases where a performance log entry can be returned,\r
+  the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.\r
+  If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
+  If Handle is NULL, then ASSERT().\r
+  If Token is NULL, then ASSERT().\r
+  If Module is NULL, then ASSERT().\r
+  If StartTimeStamp is NULL, then ASSERT().\r
+  If EndTimeStamp is NULL, then ASSERT().\r
+\r
+  @param  LogEntryKey             On entry, the key of the performance measurement log entry to retrieve.\r
+                                  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                  Pointer to environment specific context used to identify the component\r
+                                  being measured.  \r
+  @param  Token                   Pointer to a Null-terminated ASCII string that identifies the component\r
+                                  being measured. \r
+  @param  Module                  Pointer to a Null-terminated ASCII string that identifies the module\r
+                                  being measured.\r
+  @param  StartTimeStamp          Pointer to the 64-bit time stamp that was recorded when the measurement\r
+                                  was started.\r
+  @param  EndTimeStamp            Pointer to the 64-bit time stamp that was recorded when the measurement\r
+                                  was ended.\r
+\r
+  @return The key for the next performance log entry (in general case).\r
 \r
 **/\r
 UINTN\r
 EFIAPI\r
 GetPerformanceMeasurement (\r
-  UINTN           LogEntryKey, \r
+  IN  UINTN       LogEntryKey, \r
   OUT CONST VOID  **Handle,\r
   OUT CONST CHAR8 **Token,\r
   OUT CONST CHAR8 **Module,\r
@@ -180,7 +193,7 @@ PerformanceMeasurementEnabled (
   Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.\r
 \r
 **/\r
-#define PERF_CODE_END()    __PerformanceCodeLocal = 0; } } while (FALSE)\r
+#define PERF_CODE_END()    __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE)\r
 \r
 /**\r
   Macro that declares a section of performance measurement source code.\r