]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code scrub performance library instances in MdeModulePkg
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Dec 2008 15:56:02 +0000 (15:56 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Dec 2008 15:56:02 +0000 (15:56 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7037 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf

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
index 6e6324213df285245ff27f2cd4af44f7d8632c53..704256dd18f265c4ed69a5bcac8814a8a808021d 100644 (file)
@@ -1,8 +1,13 @@
 #/** @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
index 1c02959e267f3d3c4b2c860077f18985dbe3e4f3..cfa35fa847550d5c74f17ac93959495f2085eb97 100644 (file)
@@ -1,5 +1,8 @@
 /** @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
@@ -111,7 +114,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
index 35a50f726b12fe4582d9d530fba2ec56f3ae62e6..8da302769acf9ef059fc1db7dce46983871b2929 100644 (file)
@@ -1,7 +1,12 @@
 /** @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
@@ -22,6 +27,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #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
@@ -165,7 +173,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
index ff1f03b3c943bc7da586ec59b2d2016a9aa4c2b7..70c19db97ac41adf32d13cdd61ecbe260b79517e 100644 (file)
@@ -1,8 +1,10 @@
 #/** @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
@@ -45,7 +47,7 @@
 \r
 \r
 [Protocols]\r
-  gPerformanceProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED\r
+  gPerformanceProtocolGuid\r
 \r
 \r
 [Pcd.common]\r
index 64b488369a43100e31f7f3a44fd0d6bc7856afa2..97dfd0d817d250fd70b19162e60558e8530c9f3f 100644 (file)
@@ -1,5 +1,10 @@
 /** @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
index d3f611c225fd3021ab9fe040dd454f6417be6ebc..8913239ca75eb1794c1b8d4b6bbc02baff9c8249 100644 (file)
@@ -1,9 +1,10 @@
 #/** @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
@@ -49,7 +50,7 @@
 \r
 \r
 [Guids]\r
-  gPeiPerformanceHobGuid                        # SOMETIMES_CONSUMED\r
+  gPeiPerformanceHobGuid\r
 \r
 [Pcd.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries\r