X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FInclude%2FLibrary%2FPerformanceLib.h;h=0622527e7bdeeedbbb5dfefb536b7cbf9b3044ab;hp=36564095e9ec5cd9ec7e78cd11d43cde6e528c2b;hb=50a64e5b0b92772b3aa02c23a64745b51094916b;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4 diff --git a/MdePkg/Include/Library/PerformanceLib.h b/MdePkg/Include/Library/PerformanceLib.h index 36564095e9..0622527e7b 100644 --- a/MdePkg/Include/Library/PerformanceLib.h +++ b/MdePkg/Include/Library/PerformanceLib.h @@ -1,25 +1,23 @@ /** @file - Library that provides services to measure module execution performance + Provides services to log the execution times and retrieve them later. - Copyright (c) 2004, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php +Copyright (c) 2006 - 2008 Intel Corporation. +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - Module Name: PerformanceLib.h +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __PERFORMANCE_LIB_H__ #define __PERFORMANCE_LIB_H__ -// -// Performance library propery mask bits -// +/// +/// Performance library propery mask bits +/// #define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED 0x00000001 /** @@ -84,31 +82,46 @@ EndPerformanceMeasurement ( ); /** - Retrieves a previously logged performance measurement. + Attempts to retrieve a performance measurement log entry from the performance measurement log. - Looks up the record that matches Handle, Token, and Module. - If the record can not be found then return RETURN_NOT_FOUND. - If the record is found then the start of the measurement is returned in StartTimeStamp, - and the end of the measurement is returned in EndTimeStamp. - - @param LogEntryKey The key for the previous performance measurement log entry. - If 0, then the first performance measurement log entry is retrieved. - @param Handle Pointer to environment specific context used - to identify the component being measured. - @param Token Pointer to a Null-terminated ASCII string - that identifies the component being measured. - @param Module Pointer to a Null-terminated ASCII string - that identifies the module being measured. - @param StartTimeStamp The 64-bit time stamp that was recorded when the measurement was started. - @param EndTimeStamp The 64-bit time stamp that was recorded when the measurement was ended. - - @return The key for the current performance log entry. + Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is + zero on entry, then an attempt is made to retrieve the first entry from the performance log, + and the key for the second entry in the log is returned. If the performance log is empty, + then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance + log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is + returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is + retrieved and an implementation specific non-zero key value that specifies the end of the performance + log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry + is retrieved and zero is returned. In the cases where a performance log entry can be returned, + the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp. + If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT(). + If Handle is NULL, then ASSERT(). + If Token is NULL, then ASSERT(). + If Module is NULL, then ASSERT(). + If StartTimeStamp is NULL, then ASSERT(). + If EndTimeStamp is NULL, then ASSERT(). + + @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve. + 0, then the first performance measurement log entry is retrieved. + On exit, the key of the next performance lof entry entry. + @param Handle Pointer to environment specific context used to identify the component + being measured. + @param Token Pointer to a Null-terminated ASCII string that identifies the component + being measured. + @param Module Pointer to a Null-terminated ASCII string that identifies the module + being measured. + @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement + was started. + @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement + was ended. + + @return The key for the next performance log entry (in general case). **/ UINTN EFIAPI GetPerformanceMeasurement ( - UINTN LogEntryKey, + IN UINTN LogEntryKey, OUT CONST VOID **Handle, OUT CONST CHAR8 **Token, OUT CONST CHAR8 **Module, @@ -180,7 +193,7 @@ PerformanceMeasurementEnabled ( Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module. **/ -#define PERF_CODE_END() __PerformanceCodeLocal = 0; } } while (FALSE) +#define PERF_CODE_END() __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE) /** Macro that declares a section of performance measurement source code.