X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=PerformancePkg%2FDp_App%2FDp.c;h=4cdc39edb42e75ccf0221839550df5fa9fab0f2b;hp=283b61ccd4e07c52f44275bfc1c06234849af1ab;hb=9555c09717ee0b1ed4619942257c7b64aeb57f6e;hpb=b7b2b3c8beafc191e16006bf407fcce8829d8a98 diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c index 283b61ccd4..4cdc39edb4 100644 --- a/PerformancePkg/Dp_App/Dp.c +++ b/PerformancePkg/Dp_App/Dp.c @@ -13,7 +13,7 @@ Dp uses this information to group records in different ways. It also uses timer information to calculate elapsed time for each measurement. - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -114,7 +113,7 @@ InitialShellParamList( void ) // // Allocate one more for the end tag. // - ListLength = sizeof (ParamList) / sizeof (ParamList[0]) + 1; + ListLength = ARRAY_SIZE (ParamList) + 1; DpParamList = AllocatePool (sizeof (SHELL_PARAM_ITEM) * ListLength); ASSERT (DpParamList != NULL); @@ -183,25 +182,6 @@ DumpStatistics( void ) FreePool (StringPtrUnknown); } -/** - Initialize the cumulative data. - -**/ -VOID -InitCumulativeData ( - VOID - ) -{ - UINTN Index; - - for (Index = 0; Index < NumCum; ++Index) { - CumData[Index].Count = 0; - CumData[Index].MinDur = PERF_MAXDUR; - CumData[Index].MaxDur = 0; - CumData[Index].Duration = 0; - } -} - /** Dump performance data. @@ -220,14 +200,13 @@ InitializeDp ( IN EFI_SYSTEM_TABLE *SystemTable ) { - UINT64 Freq; - UINT64 Ticker; - UINT32 ListIndex; - - LIST_ENTRY *ParamPackage; - CONST CHAR16 *CmdLineArg; - EFI_STRING StringPtr; - UINTN Number2Display; + PERFORMANCE_PROPERTY *PerformanceProperty; + UINT32 ListIndex; + + LIST_ENTRY *ParamPackage; + CONST CHAR16 *CmdLineArg; + EFI_STRING StringPtr; + UINTN Number2Display; EFI_STATUS Status; BOOLEAN SummaryMode; @@ -240,6 +219,7 @@ InitializeDp ( BOOLEAN CumulativeMode; CONST CHAR16 *CustomCumulativeToken; PERF_CUM_DATA *CustomCumulativeData; + UINTN NameSize; EFI_HII_PACKAGE_LIST_HEADER *PackageList; EFI_STRING StringDpOptionQh; @@ -285,11 +265,6 @@ InitializeDp ( StringDpOptionLc = NULL; StringPtr = NULL; - // Get DP's entry time as soon as possible. - // This is used as the Shell-Phase end time. - // - Ticker = GetPerformanceCounter (); - // // Retrieve HII package list from ImageHandle // @@ -411,8 +386,9 @@ InitializeDp ( CustomCumulativeData->MaxDur = 0; CustomCumulativeData->Count = 0; CustomCumulativeData->Duration = 0; - CustomCumulativeData->Name = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1); - UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name); + NameSize = StrLen (CustomCumulativeToken) + 1; + CustomCumulativeData->Name = AllocateZeroPool (NameSize); + UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize); } /**************************************************************************** @@ -423,10 +399,16 @@ InitializeDp ( // StartCount = Value loaded into the counter when it starts counting // EndCount = Value counter counts to before it needs to be reset // - Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount); + Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty); + if (EFI_ERROR (Status) || (PerformanceProperty == NULL)) { + PrintToken (STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND)); + goto Done; + } // Convert the Frequency from Hz to KHz - TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000); + TimerInfo.Frequency = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000); + TimerInfo.StartCount = PerformanceProperty->TimerStartValue; + TimerInfo.EndCount = PerformanceProperty->TimerEndValue; // Determine in which direction the performance counter counts. TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount); @@ -504,7 +486,7 @@ InitializeDp ( else { //------------- Begin Cooked Mode Processing if (TraceMode) { - ProcessPhases ( Ticker ); + ProcessPhases (); if ( ! SummaryMode) { Status = ProcessHandles ( ExcludeMode); if (Status == EFI_ABORTED) {