X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=EdkModulePkg%2FLibrary%2FDxeCorePerformanceLib%2FDxeCorePerformanceLib.c;h=268a6a04f24b445a33098040489710fba4c40cb7;hb=6d8597dcf07d9af670966a51333b53aa8e06f4ed;hp=d2417234abaefbffcd58981845b1104b18ec7171;hpb=bc724e5885e7f2bfe5f4883ed9e1dc7e02874c9b;p=mirror_edk2.git diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index d2417234ab..268a6a04f2 100644 --- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -214,7 +214,6 @@ StartGauge ( UINTN GaugeDataSize; UINTN OldGaugeDataSize; GAUGE_DATA_HEADER *OldGaugeData; - EFI_STATUS Status; UINT32 Index; Index = mGaugeData->NumberOfEntries; @@ -230,14 +229,14 @@ StartGauge ( mGaugeData = AllocateZeroPool (GaugeDataSize); if (mGaugeData == NULL) { - return EFI_OUT_OF_MEMORY; + return EFI_OUT_OF_RESOURCES; } // // Initialize new data arry and migrate old data one. // mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize); - gBS->FreePool (OldGaugeData); + FreePool (OldGaugeData); } GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1); @@ -422,10 +421,15 @@ DxeCorePerformanceLibConstructor ( { EFI_STATUS Status; + if (!PerformanceMeasurementEnabled ()) { + // + // Do not initialize performance infrastructure if not required. + // + return EFI_SUCCESS; + } // // Install the protocol interfaces. // - Handle = NULL; Status = gBS->InstallProtocolInterface ( &mHandle, &gPerformanceProtocolGuid, @@ -434,7 +438,7 @@ DxeCorePerformanceLibConstructor ( ); ASSERT_EFI_ERROR (Status); - mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + MAX_PEI_PERFORMANCE_LOG_ENTRIES; + mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 (PcdMaxPeiPerformanceLogEntries); mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords)); ASSERT (mGaugeData != NULL);