]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
Code scrub performance library instances in MdeModulePkg
[mirror_edk2.git] / MdeModulePkg / Library / DxeCorePerformanceLib / DxeCorePerformanceLib.c
index 0b925b3c7d6c1e583ebd82dc86249d751d058a4d..f861d614300148b298c0b5fdff5bf337f2fbab8e 100644 (file)
@@ -1,5 +1,14 @@
 /** @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
@@ -17,12 +26,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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
@@ -122,7 +144,7 @@ StartGauge (
   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
@@ -135,7 +157,7 @@ StartGauge (
       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
@@ -224,7 +246,7 @@ EndGauge (
   @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
@@ -450,7 +472,7 @@ EndPerformanceMeasurement (
 \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