]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
MdeModulePkg: Add performance property configuration table
[mirror_edk2.git] / MdeModulePkg / Library / DxeCorePerformanceLib / DxeCorePerformanceLib.c
index 4739bb842661e834d1c65b05d74824342e3218c4..1564514518d3a5475a1812df5a24c7541831c86d 100644 (file)
@@ -10,7 +10,7 @@
   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 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
   GetGaugeEx\r
   };\r
 \r
+PERFORMANCE_PROPERTY  mPerformanceProperty;\r
+\r
 /**\r
   Searches in the gauge array with keyword Handle, Token, Module and Identifier.\r
 \r
@@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
   )\r
 {\r
   EFI_STATUS                Status;\r
+  PERFORMANCE_PROPERTY      *PerformanceProperty;\r
+\r
 \r
   if (!PerformanceMeasurementEnabled ()) {\r
     //\r
@@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
 \r
   InternalGetPeiPerformance ();\r
 \r
-  return Status;\r
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Install configuration table for performance property.\r
+    //\r
+    mPerformanceProperty.Revision  = PERFORMANCE_PROPERTY_REVISION;\r
+    mPerformanceProperty.Reserved  = 0;\r
+    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (\r
+                                       &mPerformanceProperty.TimerStartValue,\r
+                                       &mPerformanceProperty.TimerEndValue\r
+                                       );\r
+    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, &mPerformanceProperty);\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r