/** @file\r
- Support for measurement of DXE performance\r
+ Performance library instance mainly used by DxeCore.\r
+\r
+ This library provides the performance measurement interfaces and initializes performance\r
+ logging for DXE phase. It first initializes its private global data structure for\r
+ performance logging and saves the performance GUIDed HOB passed from PEI phase. \r
+ It initializes DXE phase performance logging by publishing the Performance Protocol,\r
+ which is consumed by DxePerformanceLib to logging performance data in DXE phase.\r
+\r
+ This library is mainly used by DxeCore to start performance logging to ensure that\r
+ Performance Protocol is installed at the very beginning of DXE phase.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
\r
\r
//\r
-// Definition for global variables.\r
+// The data structure to hold global performance data.\r
//\r
GAUGE_DATA_HEADER *mGaugeData;\r
+\r
+//\r
+// The current maximum number of logging entries. If current number of \r
+// entries exceeds this value, it will re-allocate a larger array and\r
+// migration the old data to the larger array.\r
+//\r
UINT32 mMaxGaugeRecords;\r
\r
+//\r
+// The handle to install Performance Protocol instance.\r
+//\r
EFI_HANDLE mHandle = NULL;\r
+\r
+//\r
+// Interfaces for performance protocol.\r
+//\r
PERFORMANCE_PROTOCOL mPerformanceInterface = {\r
StartGauge,\r
EndGauge,\r
Index = mGaugeData->NumberOfEntries;\r
if (Index >= mMaxGaugeRecords) {\r
//\r
- // Try to enlarge the scale of gauge arrary.\r
+ // Try to enlarge the scale of gauge array.\r
//\r
OldGaugeData = mGaugeData;\r
OldGaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;\r
return EFI_OUT_OF_RESOURCES;\r
}\r
//\r
- // Initialize new data arry and migrate old data one.\r
+ // Initialize new data array and migrate old data one.\r
//\r
mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize);\r
\r
@param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
if the retrieval is successful.\r
\r
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.\r
+ @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
@retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
@retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
@retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\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
+ On exit, the key of the next performance log 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
#/** @file\r
+# Performance library instance mainly for DxeCore usage.\r
# \r
-# Component description file for DxeCore Performance Library\r
-# \r
-# This library provides intrastructure for DxeCore to log performance.\r
+# This library provides the performance measurement interfaces and initializes performance\r
+# logging for DXE phase. It first initializes its private global data structure for\r
+# performance logging and saves the performance GUIDed HOB passed from PEI phase. \r
+# It initializes DXE phase performance logging by publishing the Performance Protocol,\r
+# which is consumed by DxePerformanceLib to logging performance data in DXE phase.\r
+# This library is mainly used by DxeCore to start performance logging to ensure that\r
+# Performance Protocol is installed at the very beginning of DXE phase.\r
# \r
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
# All rights reserved. This program and the accompanying materials\r
/** @file\r
- Module functions' declarations are included here.\r
+ Master header files for DxeCorePerformanceLib instance.\r
+\r
+ This header file holds the prototypes of the Performance Protocol published by this\r
+ library instance at its constructor.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
@param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
if the retrieval is successful.\r
\r
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.\r
+ @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
@retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
@retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
@retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
/** @file\r
Performance Library\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+ This library instance provides infrastructure for DXE phase drivers to log performance\r
+ data. It consumes Performance Protocol published by DxeCorePerformanceLib\r
+ to log performance data. If Performance Protocol is not available, it does not log any\r
+ performance information.\r
+\r
+ Copyright (c) 2006 - 2008, Intel Corporation. <BR>\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
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/PcdLib.h>\r
\r
+//\r
+// The cached performance protocol interface.\r
+//\r
PERFORMANCE_PROTOCOL *mPerformance = NULL;\r
\r
/**\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
+ On exit, the key of the next performance log 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
#/** @file\r
+# Performance library instance used in DXE phase.\r
# \r
-# Component description file for Dxe Performance Library\r
-# \r
-# This library provides intrastructure for Dxe driver to log performance.\r
+# This library instance provides infrastructure for DXE phase drivers to log performance\r
+# data. It consumes Performance Protocol published by DxeCorePerformanceLib\r
+# to log performance data. If Performance Protocol is not available, it does not log any\r
+# performance information.\r
# \r
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
# All rights reserved. This program and the accompanying materials\r
\r
\r
[Protocols]\r
- gPerformanceProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
+ gPerformanceProtocolGuid\r
\r
\r
[Pcd.common]\r
/** @file\r
- Performance Library\r
+ Performance library instance used in PEI phase.\r
+\r
+ This file implements all APIs in Performance Library class in MdePkg. It creates\r
+ performance logging GUIDed HOB on the first performance logging and then logs the\r
+ performance data to the GUIDed HOB. Due to the limitation of temporary RAM, the maximum\r
+ number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries. \r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
#/** @file\r
# \r
-# Memory-only library functions with no library constructor/destructor\r
+# Performance library instance used in PEI phase.\r
# \r
-# This module provides the performance measurement interfaces in PEI phase, it is\r
-# one instance of Performance Libarary.\r
+# This library provides the performance measurement interfaces in PEI phase, it creates\r
+# and consumes GUIDed HOB for performance logging. The GUIDed HOB is passed to DXE phase\r
+# so that it can be taken over by DxeCorePerformanceLib. \r
# \r
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
# All rights reserved. This program and the accompanying materials\r
\r
\r
[Guids]\r
- gPeiPerformanceHobGuid # SOMETIMES_CONSUMED\r
+ gPeiPerformanceHobGuid\r
\r
[Pcd.common]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries\r