diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c index 119a6e46d2..6bb60c1500 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c @@ -164,6 +164,12 @@ WriteBootToOsPerformanceData ( UINT64 StartValue; UINT64 EndValue; BOOLEAN CountUp; + UINTN EntryIndex; + UINTN NumPerfEntries; + // + // List of flags indicating PerfEntry contains DXE handle + // + BOOLEAN *PerfEntriesAsDxeHandle; // // Retrieve time stamp count as early as possible @@ -224,7 +230,19 @@ WriteBootToOsPerformanceData ( Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER)); LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA); - + NumPerfEntries = 0; + LogEntryKey = 0; + while ((LogEntryKey = GetPerformanceMeasurement ( + LogEntryKey, + &Handle, + &Token, + &Module, + &StartTicker, + &EndTicker)) != 0) { + NumPerfEntries++; + } + PerfEntriesAsDxeHandle = AllocateZeroPool (NumPerfEntries * sizeof (BOOLEAN)); + ASSERT (PerfEntriesAsDxeHandle != NULL); // // Get DXE drivers performance @@ -232,6 +250,7 @@ WriteBootToOsPerformanceData ( for (Index = 0; Index < NoHandles; Index++) { Ticker = 0; LogEntryKey = 0; + EntryIndex = 0; while ((LogEntryKey = GetPerformanceMeasurement ( LogEntryKey, &Handle, @@ -239,6 +258,10 @@ WriteBootToOsPerformanceData ( &Module, &StartTicker, &EndTicker)) != 0) { + if (Handle == Handles[Index] && !PerfEntriesAsDxeHandle[EntryIndex]) { + PerfEntriesAsDxeHandle[EntryIndex] = TRUE; + } + EntryIndex++; if ((Handle == Handles[Index]) && (EndTicker != 0)) { Ticker += CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker); } @@ -263,12 +286,11 @@ WriteBootToOsPerformanceData ( } } - FreePool (Handles); - // // Get inserted performance data // LogEntryKey = 0; + EntryIndex = 0; while ((LogEntryKey = GetPerformanceMeasurement ( LogEntryKey, &Handle, @@ -276,7 +298,7 @@ WriteBootToOsPerformanceData ( &Module, &StartTicker, &EndTicker)) != 0) { - if (Handle == NULL && EndTicker != 0) { + if (!PerfEntriesAsDxeHandle[EntryIndex] && EndTicker != 0) { ZeroMem (&mPerfData, sizeof (PERF_DATA)); @@ -293,10 +315,14 @@ WriteBootToOsPerformanceData ( goto Done; } } + EntryIndex++; } Done: + FreePool (Handles); + FreePool (PerfEntriesAsDxeHandle); + mPerfHeader.Signiture = PERFORMANCE_SIGNATURE; //