From aa79b0b3799e95bc21e0df32a135cc5a4d749e4b Mon Sep 17 00:00:00 2001 From: jji4 Date: Wed, 3 Dec 2008 08:52:39 +0000 Subject: Global variables have been moved backward ahead of functions. Only a few cases were left due to its module structure. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6816 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 108 +---------------- .../DxeCorePerformanceLib.inf | 1 + .../DxeCorePerformanceLibInternal.h | 128 +++++++++++++++++++++ 3 files changed, 130 insertions(+), 107 deletions(-) create mode 100644 MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h (limited to 'MdeModulePkg/Library/DxeCorePerformanceLib') diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 020b94982d..0b925b3c7d 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -13,113 +13,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeCorePerformanceLibInternal.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// -// Interface declarations for Performance Protocol. -// -/** - Adds a record at the end of the performance measurement log - that records the start time of a performance measurement. - - Adds a record to the end of the performance measurement log - that contains the Handle, Token, and Module. - The end time of the new record must be set to zero. - If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. - If TimeStamp is zero, the start time in the record is filled in with the value - read from the current time stamp. - - @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 TimeStamp 64-bit time stamp. - - @retval EFI_SUCCESS The data was read correctly from the device. - @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement. - -**/ -EFI_STATUS -EFIAPI -StartGauge ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp - ); - -/** - Searches the performance measurement log from the beginning of the log - for the first matching record that contains a zero end time and fills in a valid end time. - - Searches the performance measurement log from the beginning of the log - for the first record that matches Handle, Token, and Module and has an end time value of zero. - If the record can not be found then return EFI_NOT_FOUND. - If the record is found and TimeStamp is not zero, - then the end time in the record is filled in with the value specified by TimeStamp. - If the record is found and TimeStamp is zero, then the end time in the matching record - is filled in with the current time stamp value. - - @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 TimeStamp 64-bit time stamp. - - @retval EFI_SUCCESS The end of the measurement was recorded. - @retval EFI_NOT_FOUND The specified measurement record could not be found. - -**/ -EFI_STATUS -EFIAPI -EndGauge ( - IN CONST VOID *Handle, OPTIONAL - IN CONST CHAR8 *Token, OPTIONAL - IN CONST CHAR8 *Module, OPTIONAL - IN UINT64 TimeStamp - ); - -/** - Retrieves a previously logged performance measurement. - - Retrieves the performance log entry from the performance log specified by LogEntryKey. - If it stands for a valid entry, then EFI_SUCCESS is returned and - GaugeDataEntry stores the pointer to that entry. - - @param LogEntryKey The key for the previous performance measurement log entry. - If 0, then the first performance measurement log entry is retrieved. - @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey - if the retrieval is successful. - - @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey. - @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number). - @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number). - @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL. - -**/ -EFI_STATUS -EFIAPI -GetGauge ( - IN UINTN LogEntryKey, - OUT GAUGE_DATA_ENTRY **GaugeDataEntry - ); // // Definition for global variables. @@ -134,7 +29,6 @@ PERFORMANCE_PROTOCOL mPerformanceInterface = { GetGauge }; - /** Searches in the gauge array with keyword Handle, Token and Module. diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf index bbd9f31bd0..61fefaafca 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf @@ -35,6 +35,7 @@ [Sources.common] DxeCorePerformanceLib.c + DxeCorePerformanceLibInternal.h [Packages] MdePkg/MdePkg.dec diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h new file mode 100644 index 0000000000..1c02959e26 --- /dev/null +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h @@ -0,0 +1,128 @@ +/** @file + Module functions' declarations are included here. + +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. + +**/ + +#ifndef _DXE_CORE_PERFORMANCE_LIB_INTERNAL_H_ +#define _DXE_CORE_PERFORMANCE_LIB_INTERNAL_H_ + + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Interface declarations for Performance Protocol. +// +/** + Adds a record at the end of the performance measurement log + that records the start time of a performance measurement. + + Adds a record to the end of the performance measurement log + that contains the Handle, Token, and Module. + The end time of the new record must be set to zero. + If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. + If TimeStamp is zero, the start time in the record is filled in with the value + read from the current time stamp. + + @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 TimeStamp 64-bit time stamp. + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement. + +**/ +EFI_STATUS +EFIAPI +StartGauge ( + IN CONST VOID *Handle, OPTIONAL + IN CONST CHAR8 *Token, OPTIONAL + IN CONST CHAR8 *Module, OPTIONAL + IN UINT64 TimeStamp + ); + +/** + Searches the performance measurement log from the beginning of the log + for the first matching record that contains a zero end time and fills in a valid end time. + + Searches the performance measurement log from the beginning of the log + for the first record that matches Handle, Token, and Module and has an end time value of zero. + If the record can not be found then return EFI_NOT_FOUND. + If the record is found and TimeStamp is not zero, + then the end time in the record is filled in with the value specified by TimeStamp. + If the record is found and TimeStamp is zero, then the end time in the matching record + is filled in with the current time stamp value. + + @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 TimeStamp 64-bit time stamp. + + @retval EFI_SUCCESS The end of the measurement was recorded. + @retval EFI_NOT_FOUND The specified measurement record could not be found. + +**/ +EFI_STATUS +EFIAPI +EndGauge ( + IN CONST VOID *Handle, OPTIONAL + IN CONST CHAR8 *Token, OPTIONAL + IN CONST CHAR8 *Module, OPTIONAL + IN UINT64 TimeStamp + ); + +/** + Retrieves a previously logged performance measurement. + + Retrieves the performance log entry from the performance log specified by LogEntryKey. + If it stands for a valid entry, then EFI_SUCCESS is returned and + GaugeDataEntry stores the pointer to that entry. + + @param LogEntryKey The key for the previous performance measurement log entry. + If 0, then the first performance measurement log entry is retrieved. + @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey + if the retrieval is successful. + + @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey. + @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number). + @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number). + @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL. + +**/ +EFI_STATUS +EFIAPI +GetGauge ( + IN UINTN LogEntryKey, + OUT GAUGE_DATA_ENTRY **GaugeDataEntry + ); + + +#endif -- cgit v1.2.3