+++ /dev/null
-/** @file\r
- Shell application for Displaying Performance Metrics.\r
-\r
- The Dp application reads performance data and presents it in several\r
- different formats depending upon the needs of the user. Both\r
- Trace and Measured Profiling information is processed and presented.\r
-\r
- Dp uses the "PerformanceLib" to read the measurement records.\r
- The "TimerLib" provides information about the timer, such as frequency,\r
- beginning, and ending counter values.\r
- Measurement records contain identifying information (Handle, Token, Module)\r
- and start and end time values.\r
- Dp uses this information to group records in different ways. It also uses\r
- timer information to calculate elapsed time for each measurement.\r
- \r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
- (C) Copyright 2015-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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
- \r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#include <Library/UefiApplicationEntryPoint.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/ShellLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/UefiHiiServicesLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-#include <Guid/Performance.h>\r
-\r
-#include <PerformanceTokens.h>\r
-#include "Dp.h"\r
-#include "Literals.h"\r
-#include "DpInternal.h"\r
-\r
-//\r
-// String token ID of help message text.\r
-// Shell supports to find help message in the resource section of an application image if\r
-// .MAN file is not found. This global variable is added to make build tool recognizes\r
-// that the help string is consumed by user and then build tool will add the string into\r
-// the resource section. Thus the application can use '-?' option to show help message in\r
-// Shell.\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mDpStrEngHelpTokenId = STRING_TOKEN (STR_DP_HELP_INFORMATION);\r
-\r
-//\r
-/// Module-Global Variables\r
-///@{\r
-EFI_HII_HANDLE gHiiHandle;\r
-SHELL_PARAM_ITEM *DpParamList = NULL;\r
-CHAR16 *mPrintTokenBuffer = NULL;\r
-CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];\r
-CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];\r
-UINT64 mInterestThreshold;\r
-BOOLEAN mShowId = FALSE;\r
-\r
-PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.\r
-\r
-/// Timer Specific Information.\r
-TIMER_INFO TimerInfo;\r
-\r
-/// Items for which to gather cumulative statistics.\r
-PERF_CUM_DATA CumData[] = {\r
- PERF_INIT_CUM_DATA (LOAD_IMAGE_TOK),\r
- PERF_INIT_CUM_DATA (START_IMAGE_TOK),\r
- PERF_INIT_CUM_DATA (DRIVERBINDING_START_TOK),\r
- PERF_INIT_CUM_DATA (DRIVERBINDING_SUPPORT_TOK)\r
-};\r
-\r
-/// Number of items for which we are gathering cumulative statistics.\r
-UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA);\r
-\r
-PARAM_ITEM_LIST ParamList[] = {\r
- {STRING_TOKEN (STR_DP_OPTION_QH), TypeFlag}, // -? Help\r
- {STRING_TOKEN (STR_DP_OPTION_LH), TypeFlag}, // -h Help\r
- {STRING_TOKEN (STR_DP_OPTION_UH), TypeFlag}, // -H Help\r
- {STRING_TOKEN (STR_DP_OPTION_LV), TypeFlag}, // -v Verbose Mode\r
- {STRING_TOKEN (STR_DP_OPTION_UA), TypeFlag}, // -A All, Cooked\r
- {STRING_TOKEN (STR_DP_OPTION_UR), TypeFlag}, // -R RAW All\r
- {STRING_TOKEN (STR_DP_OPTION_LS), TypeFlag}, // -s Summary\r
-#if PROFILING_IMPLEMENTED\r
- {STRING_TOKEN (STR_DP_OPTION_UP), TypeFlag}, // -P Dump Profile Data\r
- {STRING_TOKEN (STR_DP_OPTION_UT), TypeFlag}, // -T Dump Trace Data\r
-#endif\r
- {STRING_TOKEN (STR_DP_OPTION_LX), TypeFlag}, // -x eXclude Cumulative Items\r
- {STRING_TOKEN (STR_DP_OPTION_LI), TypeFlag}, // -i Display Identifier\r
- {STRING_TOKEN (STR_DP_OPTION_LC), TypeValue}, // -c Display cumulative data.\r
- {STRING_TOKEN (STR_DP_OPTION_LN), TypeValue}, // -n # Number of records to display for A and R\r
- {STRING_TOKEN (STR_DP_OPTION_LT), TypeValue} // -t # Threshold of interest\r
- };\r
-\r
-///@}\r
-\r
-/**\r
- Transfer the param list value and get the command line parse.\r
-\r
-**/\r
-VOID\r
-InitialShellParamList( void )\r
-{\r
- UINT32 ListIndex;\r
- UINT32 ListLength; \r
-\r
- //\r
- // Allocate one more for the end tag.\r
- //\r
- ListLength = ARRAY_SIZE (ParamList) + 1; \r
- DpParamList = AllocatePool (sizeof (SHELL_PARAM_ITEM) * ListLength);\r
- ASSERT (DpParamList != NULL);\r
- \r
- for (ListIndex = 0; ListIndex < ListLength - 1; ListIndex ++)\r
- { \r
- DpParamList[ListIndex].Name = HiiGetString (gHiiHandle, ParamList[ListIndex].Token, NULL); \r
- DpParamList[ListIndex].Type = ParamList[ListIndex].Type;\r
- }\r
- DpParamList[ListIndex].Name = NULL;\r
- DpParamList[ListIndex].Type = TypeMax;\r
-}\r
-\r
-/**\r
- Display Usage and Help information.\r
-**/\r
-VOID\r
-ShowHelp( void )\r
-{\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_HEAD));\r
-#if PROFILING_IMPLEMENTED\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_FLAGS));\r
-#else\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_FLAGS_2));\r
-#endif // PROFILING_IMPLEMENTED\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_PAGINATE));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_VERBOSE));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_EXCLUDE));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_STAT));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_ALL));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_RAW));\r
-#if PROFILING_IMPLEMENTED\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_TRACE));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_PROFILE));\r
-#endif // PROFILING_IMPLEMENTED\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_THRESHOLD));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_COUNT));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_ID));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_CUM_DATA));\r
- PrintToken (STRING_TOKEN (STR_DP_HELP_HELP));\r
- Print(L"\n");\r
-}\r
-\r
-/**\r
- Display the trailing Verbose information.\r
-**/\r
-VOID\r
-DumpStatistics( void )\r
-{\r
- EFI_STRING StringPtr;\r
- EFI_STRING StringPtrUnknown;\r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
-\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMTRACE), SummaryData.NumTrace);\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), SummaryData.NumIncomplete);\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPHASES), SummaryData.NumSummary);\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMHANDLES), SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPEIMS), SummaryData.NumPEIMs);\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), SummaryData.NumGlobal);\r
-#if PROFILING_IMPLEMENTED\r
- PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPROFILE), SummaryData.NumProfile);\r
-#endif // PROFILING_IMPLEMENTED\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-}\r
-\r
-/**\r
- Dump performance data.\r
- \r
- @param[in] ImageHandle The image handle.\r
- @param[in] SystemTable The system table.\r
-\r
- @retval EFI_SUCCESS Command completed successfully.\r
- @retval EFI_INVALID_PARAMETER Command usage error.\r
- @retval EFI_ABORTED The user aborts the operation.\r
- @retval value Unknown error.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeDp (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- PERFORMANCE_PROPERTY *PerformanceProperty;\r
- UINT32 ListIndex;\r
-\r
- LIST_ENTRY *ParamPackage;\r
- CONST CHAR16 *CmdLineArg;\r
- EFI_STRING StringPtr;\r
- UINTN Number2Display;\r
-\r
- EFI_STATUS Status;\r
- BOOLEAN SummaryMode;\r
- BOOLEAN VerboseMode;\r
- BOOLEAN AllMode;\r
- BOOLEAN RawMode;\r
- BOOLEAN TraceMode;\r
- BOOLEAN ProfileMode;\r
- BOOLEAN ExcludeMode;\r
- BOOLEAN CumulativeMode;\r
- CONST CHAR16 *CustomCumulativeToken;\r
- PERF_CUM_DATA *CustomCumulativeData;\r
- UINTN NameSize;\r
- EFI_HII_PACKAGE_LIST_HEADER *PackageList;\r
-\r
- EFI_STRING StringDpOptionQh;\r
- EFI_STRING StringDpOptionLh;\r
- EFI_STRING StringDpOptionUh;\r
- EFI_STRING StringDpOptionLv;\r
- EFI_STRING StringDpOptionUs;\r
- EFI_STRING StringDpOptionLs;\r
- EFI_STRING StringDpOptionUa;\r
- EFI_STRING StringDpOptionUr;\r
- EFI_STRING StringDpOptionUt;\r
- EFI_STRING StringDpOptionUp;\r
- EFI_STRING StringDpOptionLx;\r
- EFI_STRING StringDpOptionLn;\r
- EFI_STRING StringDpOptionLt;\r
- EFI_STRING StringDpOptionLi;\r
- EFI_STRING StringDpOptionLc;\r
- \r
- SummaryMode = FALSE;\r
- VerboseMode = FALSE;\r
- AllMode = FALSE;\r
- RawMode = FALSE;\r
- TraceMode = FALSE;\r
- ProfileMode = FALSE;\r
- ExcludeMode = FALSE;\r
- CumulativeMode = FALSE;\r
- CustomCumulativeData = NULL;\r
-\r
- StringDpOptionQh = NULL;\r
- StringDpOptionLh = NULL;\r
- StringDpOptionUh = NULL;\r
- StringDpOptionLv = NULL;\r
- StringDpOptionUs = NULL;\r
- StringDpOptionLs = NULL;\r
- StringDpOptionUa = NULL;\r
- StringDpOptionUr = NULL;\r
- StringDpOptionUt = NULL;\r
- StringDpOptionUp = NULL;\r
- StringDpOptionLx = NULL;\r
- StringDpOptionLn = NULL;\r
- StringDpOptionLt = NULL;\r
- StringDpOptionLi = NULL;\r
- StringDpOptionLc = NULL;\r
- StringPtr = NULL;\r
-\r
- //\r
- // Retrieve HII package list from ImageHandle\r
- //\r
- Status = gBS->OpenProtocol (\r
- ImageHandle,\r
- &gEfiHiiPackageListProtocolGuid,\r
- (VOID **) &PackageList,\r
- ImageHandle,\r
- NULL,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- //\r
- // Publish HII package list to HII Database.\r
- //\r
- Status = gHiiDatabase->NewPackageList (\r
- gHiiDatabase,\r
- PackageList,\r
- NULL,\r
- &gHiiHandle\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- ASSERT (gHiiHandle != NULL);\r
- \r
-\r
- // Initial the command list\r
- //\r
- InitialShellParamList ();\r
- \r
-/****************************************************************************\r
-**** Process Command Line arguments ****\r
-****************************************************************************/\r
- Status = ShellCommandLineParse (DpParamList, &ParamPackage, NULL, TRUE);\r
-\r
- if (EFI_ERROR(Status)) {\r
- PrintToken (STRING_TOKEN (STR_DP_INVALID_ARG));\r
- ShowHelp();\r
- }\r
- else {\r
- StringDpOptionQh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_QH), NULL);\r
- StringDpOptionLh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LH), NULL);\r
- StringDpOptionUh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UH), NULL);\r
- \r
- if (ShellCommandLineGetFlag (ParamPackage, StringDpOptionQh) ||\r
- ShellCommandLineGetFlag (ParamPackage, StringDpOptionLh) ||\r
- ShellCommandLineGetFlag (ParamPackage, StringDpOptionUh))\r
- {\r
- ShowHelp();\r
- }\r
- else {\r
- StringDpOptionLv = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LV), NULL);\r
- StringDpOptionUs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_US), NULL);\r
- StringDpOptionLs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LS), NULL);\r
- StringDpOptionUa = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UA), NULL);\r
- StringDpOptionUr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UR), NULL);\r
- StringDpOptionUt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UT), NULL);\r
- StringDpOptionUp = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UP), NULL);\r
- StringDpOptionLx = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LX), NULL);\r
- StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);\r
- StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);\r
- StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);\r
- StringDpOptionLc = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LC), NULL);\r
- \r
- // Boolean Options\r
- // \r
- VerboseMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLv);\r
- SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, StringDpOptionUs) ||\r
- ShellCommandLineGetFlag (ParamPackage, StringDpOptionLs));\r
- AllMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUa);\r
- RawMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUr);\r
-#if PROFILING_IMPLEMENTED\r
- TraceMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUt);\r
- ProfileMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUp);\r
-#endif // PROFILING_IMPLEMENTED\r
- ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);\r
- mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);\r
- CumulativeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLc);\r
-\r
- // Options with Values\r
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);\r
- if (CmdLineArg == NULL) {\r
- Number2Display = DEFAULT_DISPLAYCOUNT;\r
- }\r
- else {\r
- Number2Display = StrDecimalToUintn(CmdLineArg);\r
- if (Number2Display == 0) {\r
- Number2Display = MAXIMUM_DISPLAYCOUNT;\r
- }\r
- }\r
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLt);\r
- if (CmdLineArg == NULL) {\r
- mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us\r
- }\r
- else {\r
- mInterestThreshold = StrDecimalToUint64(CmdLineArg);\r
- }\r
- // Handle Flag combinations and default behaviors\r
- // If both TraceMode and ProfileMode are FALSE, set them both to TRUE\r
- if ((! TraceMode) && (! ProfileMode)) {\r
- TraceMode = TRUE;\r
-#if PROFILING_IMPLEMENTED\r
- ProfileMode = TRUE;\r
-#endif // PROFILING_IMPLEMENTED\r
- }\r
-\r
- //\r
- // Init the custom cumulative data.\r
- //\r
- CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, StringDpOptionLc);\r
- if (CustomCumulativeToken != NULL) {\r
- CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));\r
- ASSERT (CustomCumulativeData != NULL);\r
- CustomCumulativeData->MinDur = PERF_MAXDUR;\r
- CustomCumulativeData->MaxDur = 0;\r
- CustomCumulativeData->Count = 0;\r
- CustomCumulativeData->Duration = 0;\r
- NameSize = StrLen (CustomCumulativeToken) + 1;\r
- CustomCumulativeData->Name = AllocateZeroPool (NameSize);\r
- UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);\r
- }\r
-\r
-/****************************************************************************\r
-**** Timer specific processing ****\r
-****************************************************************************/\r
- // Get the Performance counter characteristics:\r
- // Freq = Frequency in Hz\r
- // StartCount = Value loaded into the counter when it starts counting\r
- // EndCount = Value counter counts to before it needs to be reset\r
- //\r
- Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty);\r
- if (EFI_ERROR (Status) || (PerformanceProperty == NULL)) {\r
- PrintToken (STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND));\r
- goto Done;\r
- }\r
-\r
- // Convert the Frequency from Hz to KHz\r
- TimerInfo.Frequency = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000);\r
- TimerInfo.StartCount = PerformanceProperty->TimerStartValue;\r
- TimerInfo.EndCount = PerformanceProperty->TimerEndValue;\r
-\r
- // Determine in which direction the performance counter counts.\r
- TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);\r
-\r
-/****************************************************************************\r
-**** Print heading ****\r
-****************************************************************************/\r
- // print DP's build version\r
- PrintToken (STRING_TOKEN (STR_DP_BUILD_REVISION), DP_MAJOR_VERSION, DP_MINOR_VERSION);\r
-\r
- // print performance timer characteristics\r
- PrintToken (STRING_TOKEN (STR_DP_KHZ), TimerInfo.Frequency); // Print Timer frequency in KHz\r
-\r
- if ((VerboseMode) &&\r
- (! RawMode)\r
- ) {\r
- StringPtr = HiiGetString (gHiiHandle,\r
- (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)),\r
- NULL);\r
- ASSERT (StringPtr != NULL);\r
- PrintToken (STRING_TOKEN (STR_DP_TIMER_PROPERTIES), // Print Timer count range and direction\r
- StringPtr,\r
- TimerInfo.StartCount,\r
- TimerInfo.EndCount\r
- );\r
- PrintToken (STRING_TOKEN (STR_DP_VERBOSE_THRESHOLD), mInterestThreshold);\r
- }\r
-\r
-/* **************************************************************************\r
-**** Print Sections based on command line options\r
-****\r
-**** Option modes have the following priority:\r
-**** v Verbose -- Valid in combination with any other options\r
-**** t Threshold -- Modifies All, Raw, and Cooked output\r
-**** Default is 0 for All and Raw mode\r
-**** Default is DEFAULT_THRESHOLD for "Cooked" mode\r
-**** n Number2Display Used by All and Raw mode. Otherwise ignored.\r
-**** A All -- R and S options are ignored\r
-**** R Raw -- S option is ignored\r
-**** s Summary -- Modifies "Cooked" output only\r
-**** Cooked (Default)\r
-****\r
-**** The All, Raw, and Cooked modes are modified by the Trace and Profile\r
-**** options.\r
-**** !T && !P := (0) Default, Both are displayed\r
-**** T && !P := (1) Only Trace records are displayed\r
-**** !T && P := (2) Only Profile records are displayed\r
-**** T && P := (3) Same as Default, both are displayed\r
-****************************************************************************/\r
- GatherStatistics (CustomCumulativeData);\r
- if (CumulativeMode) { \r
- ProcessCumulative (CustomCumulativeData);\r
- } else if (AllMode) {\r
- if (TraceMode) {\r
- Status = DumpAllTrace( Number2Display, ExcludeMode);\r
- if (Status == EFI_ABORTED) {\r
- goto Done;\r
- }\r
- }\r
- if (ProfileMode) {\r
- DumpAllProfile( Number2Display, ExcludeMode);\r
- }\r
- }\r
- else if (RawMode) {\r
- if (TraceMode) {\r
- Status = DumpRawTrace( Number2Display, ExcludeMode);\r
- if (Status == EFI_ABORTED) {\r
- goto Done;\r
- }\r
- }\r
- if (ProfileMode) {\r
- DumpRawProfile( Number2Display, ExcludeMode);\r
- }\r
- }\r
- else {\r
- //------------- Begin Cooked Mode Processing\r
- if (TraceMode) {\r
- ProcessPhases ();\r
- if ( ! SummaryMode) {\r
- Status = ProcessHandles ( ExcludeMode);\r
- if (Status == EFI_ABORTED) {\r
- goto Done;\r
- }\r
-\r
- Status = ProcessPeims ();\r
- if (Status == EFI_ABORTED) {\r
- goto Done;\r
- }\r
-\r
- Status = ProcessGlobal ();\r
- if (Status == EFI_ABORTED) {\r
- goto Done;\r
- }\r
-\r
- ProcessCumulative (NULL);\r
- }\r
- }\r
- if (ProfileMode) {\r
- DumpAllProfile( Number2Display, ExcludeMode);\r
- }\r
- } //------------- End of Cooked Mode Processing\r
- if ( VerboseMode || SummaryMode) {\r
- DumpStatistics();\r
- }\r
- }\r
- }\r
-\r
-Done:\r
-\r
- //\r
- // Free the memory allocate from HiiGetString\r
- //\r
- ListIndex = 0;\r
- while (DpParamList[ListIndex].Name != NULL) {\r
- FreePool (DpParamList[ListIndex].Name);\r
- ListIndex ++;\r
- } \r
- FreePool (DpParamList);\r
-\r
- SafeFreePool (StringDpOptionQh);\r
- SafeFreePool (StringDpOptionLh);\r
- SafeFreePool (StringDpOptionUh);\r
- SafeFreePool (StringDpOptionLv);\r
- SafeFreePool (StringDpOptionUs);\r
- SafeFreePool (StringDpOptionLs);\r
- SafeFreePool (StringDpOptionUa);\r
- SafeFreePool (StringDpOptionUr);\r
- SafeFreePool (StringDpOptionUt);\r
- SafeFreePool (StringDpOptionUp);\r
- SafeFreePool (StringDpOptionLx);\r
- SafeFreePool (StringDpOptionLn);\r
- SafeFreePool (StringDpOptionLt);\r
- SafeFreePool (StringDpOptionLi);\r
- SafeFreePool (StringDpOptionLc);\r
- SafeFreePool (StringPtr);\r
- SafeFreePool (mPrintTokenBuffer);\r
-\r
- if (ParamPackage != NULL) {\r
- ShellCommandLineFreeVarList (ParamPackage);\r
- }\r
- if (CustomCumulativeData != NULL) {\r
- SafeFreePool (CustomCumulativeData->Name);\r
- }\r
- SafeFreePool (CustomCumulativeData);\r
-\r
- HiiRemovePackages (gHiiHandle);\r
- return Status;\r
-}\r
+++ /dev/null
-/** @file\r
- Common declarations for the Dp Performance Reporting Utility.\r
-\r
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#ifndef _EFI_APP_DP_H_\r
-#define _EFI_APP_DP_H_\r
-\r
-#include <Library/ShellLib.h>\r
-\r
-#define DP_MAJOR_VERSION 2\r
-#define DP_MINOR_VERSION 3\r
-\r
-/**\r
- * The value assigned to DP_DEBUG controls which debug output\r
- * is generated. Set it to ZERO to disable.\r
-**/\r
-#define DP_DEBUG 0\r
-\r
-/**\r
- * Set to 1 once Profiling has been implemented in order to enable\r
- * profiling related options and report output.\r
-**/\r
-#define PROFILING_IMPLEMENTED 0\r
-\r
-#define DEFAULT_THRESHOLD 1000 ///< One millisecond.\r
-#define DEFAULT_DISPLAYCOUNT 50\r
-#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.\r
-\r
-#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL\r
-\r
-/// Determine whether 0 <= C < L. If L == 0, return true regardless of C.\r
-#define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )\r
-\r
-/// Structure for storing Timer specific information.\r
-typedef struct {\r
- UINT64 StartCount; ///< Value timer is initialized with.\r
- UINT64 EndCount; ///< Value timer has just before it wraps.\r
- UINT32 Frequency; ///< Timer count frequency in KHz.\r
- BOOLEAN CountUp; ///< TRUE if the counter counts up.\r
-} TIMER_INFO;\r
-\r
-/** Initialize one PERF_CUM_DATA structure instance for token t.\r
- *\r
- * This parameterized macro takes a single argument, t, which is expected\r
- * to resolve to a pointer to an ASCII string literal. This parameter may\r
- * take any one of the following forms:\r
- * - PERF_INIT_CUM_DATA("Token") A string literal\r
- * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;\r
- * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];\r
-**/\r
-#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }\r
-\r
-typedef struct {\r
- UINT64 Duration; ///< Cumulative duration for this item.\r
- UINT64 MinDur; ///< Smallest duration encountered.\r
- UINT64 MaxDur; ///< Largest duration encountered.\r
- CHAR8 *Name; ///< ASCII name of this item.\r
- UINT32 Count; ///< Total number of measurements accumulated.\r
-} PERF_CUM_DATA;\r
-\r
-typedef struct {\r
- UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.\r
- UINT32 NumProfile; ///< Number of recorded PROFILE performance measurements.\r
- UINT32 NumIncomplete; ///< Number of measurements with no END value.\r
- UINT32 NumSummary; ///< Number of summary section measurements.\r
- UINT32 NumHandles; ///< Number of measurements with handles.\r
- UINT32 NumPEIMs; ///< Number of measurements of PEIMs.\r
- UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.\r
-} PERF_SUMMARY_DATA;\r
-\r
-typedef struct {\r
- CONST VOID *Handle;\r
- CONST CHAR8 *Token; ///< Measured token string name.\r
- CONST CHAR8 *Module; ///< Module string name.\r
- UINT64 StartTimeStamp; ///< Start time point.\r
- UINT64 EndTimeStamp; ///< End time point.\r
- UINT32 Identifier; ///< Identifier.\r
-} MEASUREMENT_RECORD;\r
-\r
-typedef struct {\r
- CHAR8 *Name; ///< Measured token string name.\r
- UINT64 CumulativeTime; ///< Accumulated Elapsed Time.\r
- UINT64 MinTime; ///< Minimum Elapsed Time.\r
- UINT64 MaxTime; ///< Maximum Elapsed Time.\r
- UINT32 Count; ///< Number of measurements accumulated.\r
-} PROFILE_RECORD;\r
-\r
-typedef struct {\r
- UINT16 Token;\r
- SHELL_PARAM_TYPE Type;\r
-} PARAM_ITEM_LIST;\r
-#endif // _EFI_APP_DP_H_\r
+++ /dev/null
-## @file\r
-# Display Performance Application, Module information file.\r
-#\r
-# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010006\r
- BASE_NAME = DP\r
- FILE_GUID = 7d5ff0e3-2fb7-4e19-8419-44266cb60000\r
- MODULE_TYPE = UEFI_APPLICATION\r
- VERSION_STRING = 1.0\r
- ENTRY_POINT = InitializeDp\r
- \r
-#\r
-# This flag specifies whether HII resource section is generated into PE image.\r
-#\r
- UEFI_HII_RESOURCE_SECTION = TRUE\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources]\r
- DpStrings.uni\r
- Dp.c\r
- Dp.h\r
- Literals.h\r
- Literals.c\r
- DpInternal.h\r
- DpUtilities.c\r
- DpTrace.c\r
- DpProfile.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- ShellPkg/ShellPkg.dec\r
- PerformancePkg/PerformancePkg.dec\r
-\r
-[LibraryClasses]\r
- UefiApplicationEntryPoint\r
- ShellLib\r
- BaseMemoryLib\r
- BaseLib\r
- MemoryAllocationLib\r
- DebugLib\r
- UefiBootServicesTableLib\r
- PeCoffGetEntryPointLib\r
- PerformanceLib\r
- PrintLib\r
- UefiLib\r
- HiiLib\r
- UefiHiiServicesLib\r
- PcdLib\r
- DevicePathLib\r
- DxeServicesLib\r
-\r
-[Guids]\r
- gPerformanceProtocolGuid ## CONSUMES ## SystemTable\r
-\r
-[Protocols]\r
- gEfiLoadedImageProtocolGuid ## CONSUMES\r
- gEfiHiiPackageListProtocolGuid ## CONSUMES\r
- gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMES\r
- gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMES\r
- gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMES\r
-\r
-[Pcd]\r
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## CONSUMES\r
+++ /dev/null
-/** @file\r
- Declarations of objects defined internally to the Dp Application.\r
-\r
- Declarations of data and functions which are private to the Dp application.\r
- This file should never be referenced by anything other than components of the\r
- Dp application. In addition to global data, function declarations for\r
- DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
-\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
- (C) Copyright 2015-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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#ifndef _DP_INTELNAL_H_\r
-#define _DP_INTELNAL_H_\r
-\r
-#define DP_GAUGE_STRING_LENGTH 36\r
-\r
-//\r
-/// Module-Global Variables\r
-///@{\r
-extern EFI_HII_HANDLE gHiiHandle;\r
-extern CHAR16 *mPrintTokenBuffer;\r
-extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];\r
-extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];\r
-extern UINT64 mInterestThreshold;\r
-extern BOOLEAN mShowId;\r
-\r
-extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.\r
-\r
-/// Timer Specific Information.\r
-extern TIMER_INFO TimerInfo;\r
-\r
-/// Items for which to gather cumulative statistics.\r
-extern PERF_CUM_DATA CumData[];\r
-\r
-/// Number of items for which we are gathering cumulative statistics.\r
-extern UINT32 const NumCum;\r
-\r
-///@}\r
-\r
-/** \r
- Calculate an event's duration in timer ticks.\r
- \r
- Given the count direction and the event's start and end timer values,\r
- calculate the duration of the event in timer ticks. Information for\r
- the current measurement is pointed to by the parameter.\r
- \r
- If the measurement's start time is 1, it indicates that the developer\r
- is indicating that the measurement began at the release of reset.\r
- The start time is adjusted to the timer's starting count before performing\r
- the elapsed time calculation.\r
- \r
- The calculated duration, in ticks, is the absolute difference between\r
- the measurement's ending and starting counts.\r
- \r
- @param Measurement Pointer to a MEASUREMENT_RECORD structure containing\r
- data for the current measurement.\r
- \r
- @return The 64-bit duration of the event.\r
-**/\r
-UINT64\r
-GetDuration (\r
- IN OUT MEASUREMENT_RECORD *Measurement\r
- );\r
-\r
-/** \r
- Determine whether the Measurement record is for an EFI Phase.\r
- \r
- The Token and Module members of the measurement record are checked.\r
- Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.\r
- \r
- @param[in] Measurement A pointer to the Measurement record to test.\r
- \r
- @retval TRUE The measurement record is for an EFI Phase.\r
- @retval FALSE The measurement record is NOT for an EFI Phase.\r
-**/\r
-BOOLEAN\r
-IsPhase(\r
- IN MEASUREMENT_RECORD *Measurement\r
- );\r
-\r
-/** \r
- Get the file name portion of the Pdb File Name.\r
- \r
- The portion of the Pdb File Name between the last backslash and\r
- either a following period or the end of the string is converted\r
- to Unicode and copied into UnicodeBuffer. The name is truncated,\r
- if necessary, to ensure that UnicodeBuffer is not overrun.\r
- \r
- @param[in] PdbFileName Pdb file name.\r
- @param[out] UnicodeBuffer The resultant Unicode File Name.\r
- \r
-**/\r
-VOID\r
-GetShortPdbFileName (\r
- IN CHAR8 *PdbFileName,\r
- OUT CHAR16 *UnicodeBuffer\r
- );\r
-\r
-/** \r
- Get a human readable name for an image handle.\r
- The following methods will be tried orderly:\r
- 1. Image PDB\r
- 2. ComponentName2 protocol\r
- 3. FFS UI section\r
- 4. Image GUID\r
- 5. Image DevicePath\r
- 6. Unknown Driver Name\r
- \r
- @param[in] Handle\r
- \r
- @post The resulting Unicode name string is stored in the\r
- mGaugeString global array.\r
- \r
-**/\r
-VOID\r
-GetNameFromHandle (\r
- IN EFI_HANDLE Handle\r
- );\r
-\r
-/** \r
- Calculate the Duration in microseconds.\r
- \r
- Duration is multiplied by 1000, instead of Frequency being divided by 1000 or\r
- multiplying the result by 1000, in order to maintain precision. Since Duration is\r
- a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.\r
- \r
- The time is calculated as (Duration * 1000) / Timer_Frequency.\r
- \r
- @param[in] Duration The event duration in timer ticks.\r
- \r
- @return A 64-bit value which is the Elapsed time in microseconds.\r
-**/\r
-UINT64\r
-DurationInMicroSeconds (\r
- IN UINT64 Duration\r
- );\r
-\r
-/** \r
- Formatted Print using a Hii Token to reference the localized format string.\r
- \r
- @param[in] Token A HII token associated with a localized Unicode string.\r
- @param[in] ... The variable argument list.\r
- \r
- @return The number of characters converted by UnicodeVSPrint().\r
- \r
-**/\r
-UINTN\r
-EFIAPI\r
-PrintToken (\r
- IN UINT16 Token,\r
- ...\r
- );\r
-\r
-/** \r
- Get index of Measurement Record's match in the CumData array.\r
- \r
- If the Measurement's Token value matches a Token in one of the CumData\r
- records, the index of the matching record is returned. The returned\r
- index is a signed value so that negative values can indicate that\r
- the Measurement didn't match any entry in the CumData array.\r
- \r
- @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.\r
- \r
- @retval <0 Token is not in the CumData array.\r
- @retval >=0 Return value is the index into CumData where Token is found.\r
-**/\r
-INTN\r
-GetCumulativeItem(\r
- IN MEASUREMENT_RECORD *Measurement\r
- );\r
-\r
-/** \r
- Collect verbose statistics about the logged performance measurements.\r
- \r
- General Summary information for all Trace measurements is gathered and\r
- stored within the SummaryData structure. This information is both\r
- used internally by subsequent reporting functions, and displayed\r
- at the end of verbose reports.\r
- \r
- @pre The SummaryData and CumData structures must be initialized\r
- prior to calling this function.\r
- \r
- @post The SummaryData and CumData structures contain statistics for the\r
- current performance logs.\r
-\r
- @param[in, out] CustomCumulativeData The pointer to the custom cumulative data.\r
-\r
-**/\r
-VOID\r
-GatherStatistics(\r
- IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r
- );\r
-\r
-/** \r
- Gather and print ALL Trace Records.\r
- \r
- Displays all "interesting" Trace measurements in order.<BR>\r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
- They must not be in use by a calling function.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
- @return Others from a call to gBS->LocateHandleBuffer().\r
-**/\r
-EFI_STATUS\r
-DumpAllTrace(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- );\r
-\r
-/** \r
- Gather and print Raw Trace Records.\r
- \r
- All Trace measurements with a duration greater than or equal to\r
- mInterestThreshold are printed without interpretation.\r
- \r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-DumpRawTrace(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- );\r
-\r
-/** \r
- Gather and print Major Phase metrics.\r
- \r
-**/\r
-VOID\r
-ProcessPhases(\r
- VOID\r
- );\r
-\r
-\r
-/** \r
- Gather and print Handle data.\r
- \r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
- @return Others from a call to gBS->LocateHandleBuffer().\r
-**/\r
-EFI_STATUS\r
-ProcessHandles(\r
- IN BOOLEAN ExcludeFlag\r
- );\r
-\r
-\r
-/** \r
- Gather and print PEIM data.\r
- \r
- Only prints complete PEIM records\r
- \r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-ProcessPeims(\r
- VOID\r
- );\r
-\r
-/** \r
- Gather and print global data.\r
- \r
- Strips out incomplete or "Execution Phase" records\r
- Only prints records where Handle is NULL\r
- Increment TIndex for every record, even skipped ones, so that we have an\r
- indication of every measurement record taken.\r
- \r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-ProcessGlobal(\r
- VOID\r
- );\r
-\r
-/** \r
- Gather and print cumulative data.\r
- \r
- Traverse the measurement records and:<BR>\r
- For each record with a Token listed in the CumData array:<BR>\r
- - Update the instance count and the total, minimum, and maximum durations.\r
- Finally, print the gathered cumulative statistics.\r
-\r
- @param[in] CustomCumulativeData The pointer to the custom cumulative data.\r
- \r
-**/\r
-VOID\r
-ProcessCumulative(\r
- IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r
- );\r
-\r
-/** \r
- Gather and print ALL Profiling Records.\r
- \r
- Displays all "interesting" Profile measurements in order.\r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
- They must not be in use by a calling function.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
-**/\r
-VOID\r
-DumpAllProfile(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- );\r
-\r
-/** \r
- Gather and print Raw Profile Records.\r
- \r
- All Profile measurements with a duration greater than or equal to\r
- mInterestThreshold are printed without interpretation.\r
- \r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
-**/\r
-VOID\r
-DumpRawProfile(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- );\r
-\r
-/**\r
- Wrap original FreePool to check NULL pointer first.\r
-\r
- @param[in] Buffer The pointer to the buffer to free.\r
-\r
-**/\r
-VOID\r
-SafeFreePool (\r
- IN VOID *Buffer\r
- );\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- Measured Profiling reporting for the Dp utility.\r
-\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/PerformanceLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-#include <Guid/Performance.h>\r
-\r
-#include "Dp.h"\r
-#include "Literals.h"\r
-#include "DpInternal.h"\r
-\r
-/** \r
- Gather and print ALL Profiling Records.\r
- \r
- Displays all "interesting" Profile measurements in order.\r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
- They must not be in use by a calling function.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
-**/\r
-VOID\r
-DumpAllProfile(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- )\r
-{\r
- EFI_STRING StringPtr;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r
-\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
- return;\r
-}\r
-\r
-/** \r
- Gather and print Raw Profile Records.\r
- \r
- All Profile measurements with a duration greater than or equal to\r
- mInterestThreshold are printed without interpretation.\r
- \r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
-**/\r
-VOID\r
-DumpRawProfile(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- )\r
-{\r
- EFI_STRING StringPtr;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
- return;\r
-}\r
+++ /dev/null
-// *++\r
-//\r
-// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
-// (C) Copyright 2015 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
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-//\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-//\r
-// Module Name:\r
-//\r
-// DpStrings.uni\r
-//\r
-// Abstract:\r
-//\r
-// String definitions for the Shell dp command\r
-//\r
-// Revision History:\r
-//\r
-// --*/\r
-\r
-/=#\r
-\r
-#langdef en-US "English"\r
-#langdef fr-FR "Français"\r
-\r
-#string STR_DP_HELP_INFORMATION #language en-US ""\r
- ".TH DP 0 "Display Performance metrics."\r\n"\r
- ".SH NAME\r\n"\r
- "Display Performance metrics.\r\n"\r
- ".SH SYNOPSIS\r\n"\r
- " \r\n"\r
- "If Profiling is implemented:\r\n"\r
- "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"\r
- "If Profiling is not implemented:\r\n"\r
- "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"\r
- ".SH OPTIONS\r\n"\r
- " \r\n"\r
- " -b display on multiple pages\n\r\n"\r
- " -v display additional information\r\n"\r
- " -x prevent display of individual measurements for cumulative items\r\n"\r
- " -s display summary information only\r\n"\r
- " -A display all measurements in a list\r\n"\r
- " -R display all measurements in raw format\r\n"\r
- " -T display Trace measurements only(This option is available when Profiling is implemented)\r\n"\r
- " -P display Profile measurements only(This option is available when Profiling is implemented)\r\n"\r
- " -t VALUE Set display threshold to VALUE microseconds\r\n"\r
- " -n COUNT Limit display to COUNT lines in All and Raw modes\r\n"\r
- " -i display identifier\r\n"\r
- " -c TOKEN - Display pre-defined and custom cumulative data\r\n"\r
- " Pre-defined cumulative token are:\r\n"\r
- " 1. LoadImage:\r\n"\r
- " 2. StartImage:\r\n"\r
- " 3. DB:Start:\r\n"\r
- " 4. DB:Support:\r\n"\r
- " -? display dp help information\r\n"\r
- "\r\n"\r
- #language fr-FR ""\r
- ".TH DP 0 "Montrer les données d'exécution"\r\n"\r
- ".SH NAME\r\n"\r
- "Montrer les données d'exécution\r\n"\r
- ".SH SYNOPSIS\r\n"\r
- " \r\n"\r
- "If Profiling is implemented:\r\n"\r
- "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"\r
- "If Profiling is not implemented:\r\n"\r
- "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"\r
- ".SH OPTIONS\r\n"\r
- " \r\n"\r
- " -b montrer sur les pages multiples\r\n"\r
- " -v display additional information\r\n"\r
- " -x prevent display of individual measurements for cumulative items\r\n"\r
- " -s montrer les données de statistique seulement\r\n"\r
- " -A\r\n"\r
- " -R\r\n"\r
- " -T\r\n"\r
- " -P\r\n"\r
- " -t VALUE\r\n"\r
- " -n COUNT\r\n"\r
- " -i\r\n"\r
- " -c\r\n"\r
- " -? montrer dp aider l'information\r\n"\r
- "\r\n"\r
-\r
-#string STR_DP_HELP_HEAD #language en-US "\nDisplay Performance metrics\n"\r
- #language fr-FR "\nMontrer les données d'exécution\n"\r
-#string STR_DP_HELP_FLAGS #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\n"\r
- #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\n"\r
-#string STR_DP_HELP_FLAGS_2 #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\n"\r
- #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\n"\r
-#string STR_DP_HELP_PAGINATE #language en-US " -b display on multiple pages\n"\r
- #language fr-FR " -b montrer sur les pages multiples\n"\r
-#string STR_DP_HELP_VERBOSE #language en-US " -v display additional information\n"\r
- #language fr-FR " -v display additional information\n"\r
-#string STR_DP_HELP_EXCLUDE #language en-US " -x prevent display of individual measurements for cumulative items.\n"\r
- #language fr-FR " -x prevent display of individual measurements for cumulative items.\n"\r
-#string STR_DP_HELP_STAT #language en-US " -s display summary information only\n"\r
- #language fr-FR " -s montrer les données de statistique seulement\n"\r
-#string STR_DP_HELP_ALL #language en-US " -A display all measurements in a list\n"\r
- #language fr-FR " -A\n"\r
-#string STR_DP_HELP_RAW #language en-US " -R display all measurements in raw format\n"\r
- #language fr-FR " -R\n"\r
-#string STR_DP_HELP_TRACE #language en-US " -T display Trace measurements only\n"\r
- #language fr-FR " -T\n"\r
-#string STR_DP_HELP_PROFILE #language en-US " -P display Profile measurements only\n"\r
- #language fr-FR " -P\n"\r
-#string STR_DP_HELP_THRESHOLD #language en-US " -t VALUE Set display threshold to VALUE microseconds\n"\r
- #language fr-FR " -t VALUE\n"\r
-#string STR_DP_HELP_COUNT #language en-US " -n COUNT Limit display to COUNT lines in All and Raw modes\n"\r
- #language fr-FR " -n COUNT\n"\r
-#string STR_DP_HELP_ID #language en-US " -i display identifier\n"\r
- #language fr-FR " -i\n"\r
-#string STR_DP_HELP_CUM_DATA #language en-US " -c TOKEN - Display pre-defined and custom cumulative data\r\n"\r
- " Pre-defined cumulative token are:\r\n"\r
- " 1. LoadImage:\r\n"\r
- " 2. StartImage:\r\n"\r
- " 3. DB:Start:\r\n"\r
- " 4. DB:Support:\r\n"\r
- #language fr-FR " -c\n"\r
-#string STR_DP_HELP_HELP #language en-US " -? display dp help information\n"\r
- #language fr-FR " -? montrer dp aider l'information\n"\r
-#string STR_DP_UP #language en-US "UP"\r
- #language fr-FR "UP"\r
-#string STR_DP_DOWN #language en-US "DOWN"\r
- #language fr-FR "DOWN"\r
-#string STR_DP_DASHES #language en-US "-------------------------------------------------------------------------------\n"\r
- #language fr-FR "-------------------------------------------------------------------------------\n"\r
-#string STR_DP_SECTION_HEADER #language en-US "\n==[ %s ]========\n"\r
- #language fr-FR "\n==[ %s ]========\n"\r
-#string STR_DP_INVALID_ARG #language en-US "Invalid argument(s)\n"\r
- #language fr-FR "Argument d'invalide(s)\n"\r
-#string STR_DP_HANDLES_ERROR #language en-US "Locate All Handles error - %r\n"\r
- #language fr-FR "Localiser Toute erreur de Poignées - %r\n"\r
-#string STR_DP_ERROR_NAME #language en-US "Unknown Driver Name"\r
- #language fr-FR "Unknown Driver Name"\r
-#string STR_PERF_PROPERTY_NOT_FOUND #language en-US "Performance property not found\n"\r
- #language fr-FR "Performance property not found\n"\r
-#string STR_DP_BUILD_REVISION #language en-US "\nDP Build Version: %d.%d\n"\r
- #language fr-FR "\nDP Construit la Version: %d,%d\n"\r
-#string STR_DP_KHZ #language en-US "System Performance Timer Frequency: %,8d (KHz)\n"\r
- #language fr-FR "System Performance Timer Frequency: %,8d (KHz)\n"\r
-#string STR_DP_TIMER_PROPERTIES #language en-US "System Performance Timer counts %s from 0x%Lx to 0x%Lx\n"\r
- #language fr-FR "System Performance Timer counts %s from 0x%Lx to 0x%Lx\n"\r
-#string STR_DP_VERBOSE_THRESHOLD #language en-US "Measurements less than %,Ld microseconds are not displayed.\n"\r
- #language fr-FR "Measurements less than %,Ld microseconds are not displayed.\n"\r
-#string STR_DP_SECTION_PHASES #language en-US "Major Phases"\r
- #language fr-FR "Major Phases"\r
-#string STR_DP_SEC_PHASE #language en-US " SEC Phase Duration: %L8d (us)\n"\r
- #language fr-FR " SEC Phase Duration: %L8d (us)\n"\r
-#string STR_DP_PHASE_BDSTO #language en-US " BDS Timeout: %L8d (ms) included in BDS Duration\n"\r
- #language fr-FR " BDS Timeout: %L8d (ms) included in BDS Duration\n"\r
-#string STR_DP_PHASE_DURATION #language en-US "%5a Phase Duration: %L8d (ms)\n"\r
- #language fr-FR "%5a Phase Duration: %L8d (ms)\n"\r
-#string STR_DP_TOTAL_DURATION #language en-US "Total Duration: %L8d (ms)\n"\r
- #language fr-FR "Total Duration: %L8d (ms)\n"\r
-#string STR_DP_SECTION_DRIVERS #language en-US "Drivers by Handle"\r
- #language fr-FR "Drivers by Handle"\r
-#string STR_DP_HANDLE_SECTION #language en-US "Index: Handle Driver Name Description Time(us)\n"\r
- #language fr-FR "Index: Poignée Nom(GUID) Description Temps(us)\n"\r
-#string STR_DP_HANDLE_VARS #language en-US "%5d: [%3x] %36s %11s %L8d\n"\r
- #language fr-FR "%5d: [%3x] %36s %11s %L8d\n"\r
-#string STR_DP_HANDLE_SECTION2 #language en-US "Index: Handle Driver Name Description Time(us) ID\n"\r
- #language fr-FR "Index: Poignée Nom(GUID) Description Temps(us) ID\n"\r
-#string STR_DP_HANDLE_VARS2 #language en-US "%5d: [%3x] %36s %11s %L8d %5d\n"\r
- #language fr-FR "%5d: [%3x] %36s %11s %L8d %5d\n"\r
-#string STR_DP_SECTION_PEIMS #language en-US "PEIMs"\r
- #language fr-FR "PEIMs"\r
-#string STR_DP_PEIM_SECTION #language en-US "Index: Pointer Value Instance GUID Token Time(us)\n"\r
- #language fr-FR "Index: Pointer Value Instance GUID Token Temps(us)\n"\r
-#string STR_DP_PEIM_VARS #language en-US "%5d: 0x%11p %g PEIM %L8d\n"\r
- #language fr-FR "%5d: 0x%11p %g PEIM %L8d\n"\r
-#string STR_DP_PEIM_SECTION2 #language en-US "Index: Pointer Value Instance GUID Token Time(us) ID\n"\r
- #language fr-FR "Index: Pointer Value Instance GUID Token Temps(us) ID\n"\r
-#string STR_DP_PEIM_VARS2 #language en-US "%5d: 0x%11p %g PEIM %L8d %5d\n"\r
- #language fr-FR "%5d: 0x%11p %g PEIM %L8d %5d\n"\r
-#string STR_DP_SECTION_GENERAL #language en-US "General"\r
- #language fr-FR "General"\r
-#string STR_DP_GLOBAL_SECTION #language en-US "Index Name Description Time(us)\n"\r
- #language fr-FR "Index Nom Description Temps(us)\n"\r
-#string STR_DP_GLOBAL_VARS #language en-US "%5d:%25s %31s %L8d\n"\r
- #language fr-FR "%5d:%25s %31s %L8d\n"\r
-#string STR_DP_GLOBAL_SECTION2 #language en-US "Index Name Description Time(us) ID\n"\r
- #language fr-FR "Index Nom Description Temps(us) ID\n"\r
-#string STR_DP_GLOBAL_VARS2 #language en-US "%5d:%25s %31s %L8d %5d\n"\r
- #language fr-FR "%5d:%25s %31s %L8d %5d\n"\r
-#string STR_DP_SECTION_CUMULATIVE #language en-US "Cumulative"\r
- #language fr-FR "Cumulative"\r
-#string STR_DP_CUMULATIVE_SECT_1 #language en-US "(Times in microsec.) Cumulative Average Shortest Longest\n"\r
- #language fr-FR "(Times in microsec.) Cumulative Average Shortest Longest\n"\r
-#string STR_DP_CUMULATIVE_SECT_2 #language en-US " Name Count Duration Duration Duration Duration\n"\r
- #language fr-FR " Name Count Duration Duration Duration Duration\n"\r
-#string STR_DP_CUMULATIVE_STATS #language en-US "%11a %8d %L10d %L10d %L10d %L10d\n"\r
- #language fr-FR "%11a %8d %L10d %L10d %L10d %L10d\n"\r
-#string STR_DP_SECTION_STATISTICS #language en-US "Statistics"\r
- #language fr-FR "Statistics"\r
-#string STR_DP_STATS_NUMTRACE #language en-US "There were %d measurements taken, of which:\n"\r
- #language fr-FR "There were %d measurements taken, of which:\n"\r
-#string STR_DP_STATS_NUMINCOMPLETE #language en-US "%,8d are incomplete.\n"\r
- #language fr-FR "%,8d are incomplete.\n"\r
-#string STR_DP_STATS_NUMPHASES #language en-US "%,8d are major execution phases.\n"\r
- #language fr-FR "%,8d are major execution phases.\n"\r
-#string STR_DP_STATS_NUMHANDLES #language en-US "%,8d have non-NULL handles, %d are NULL.\n"\r
- #language fr-FR "%,8d have non-NULL handles, %d are NULL.\n"\r
-#string STR_DP_STATS_NUMPEIMS #language en-US "%,8d are PEIMs.\n"\r
- #language fr-FR "%,8d are PEIMs.\n"\r
-#string STR_DP_STATS_NUMGLOBALS #language en-US "%,8d are general measurements.\n"\r
- #language fr-FR "%,8d are general measurements.\n"\r
-#string STR_DP_STATS_NUMPROFILE #language en-US "%,8d are profiling records.\n"\r
- #language fr-FR "%,8d are profiling records.\n"\r
-#string STR_DP_SECTION_PROFILE #language en-US "Sequential Profile Records"\r
- #language fr-FR "Sequential Profile Records"\r
-#string STR_DP_SECTION_ALL #language en-US "Sequential Trace Records"\r
- #language fr-FR "Sequential Trace Records"\r
-#string STR_DP_ALL_HEADR #language en-US "\nIndex Handle Module Token Time(us)\n"\r
- #language fr-FR "\nIndex Handle Module Token Temps(us)\n"\r
-#string STR_DP_ALL_VARS #language en-US "%5d:%3s0x%08p %36s %13s %L8d\n"\r
- #language fr-FR "%5d:%3s0x%08p %36s %13s %L8d\n"\r
-#string STR_DP_ALL_DASHES2 #language en-US "-------------------------------------------------------------------------------------\n"\r
- #language fr-FR "-------------------------------------------------------------------------------------\n"\r
-#string STR_DP_ALL_HEADR2 #language en-US "\nIndex Handle Module Token Time(us) ID\n"\r
- #language fr-FR "\nIndex Handle Module Token Temps(us) ID\n"\r
-#string STR_DP_ALL_VARS2 #language en-US "%5d:%3s0x%08p %36s %13s %L8d %5d\n"\r
- #language fr-FR "%5d:%3s0x%08p %36s %13s %L8d %5d\n"\r
-#string STR_DP_SECTION_RAWTRACE #language en-US "RAW Trace"\r
- #language fr-FR "RAW Trace"\r
-#string STR_DP_SECTION_RAWPROFILE #language en-US "RAW Profile"\r
- #language fr-FR "RAW Profile"\r
-#string STR_DP_RAW_DASHES #language en-US "---------------------------------------------------------------------------------------------------------------------------\n"\r
- #language fr-FR "---------------------------------------------------------------------------------------------------------------------------\n"\r
-#string STR_DP_RAW_VARS #language en-US "%5d: %16LX %16LX %16LX %31a %31a\n"\r
- #language fr-FR "%5d: %16LX %16LX %16LX %31a %31a\n"\r
-#string STR_DP_RAW_HEADR #language en-US "\nIndex Handle Start Count End Count Token Module\n"\r
- #language fr-FR "\nIndex Handle Start Count End Count Token Module\n"\r
-#string STR_DP_RAW_DASHES2 #language en-US "---------------------------------------------------------------------------------------------------------------------------------\n"\r
- #language fr-FR "---------------------------------------------------------------------------------------------------------------------------------\n"\r
-#string STR_DP_RAW_VARS2 #language en-US "%5d: %16LX %16LX %16LX %31a %31a %5d\n"\r
- #language fr-FR "%5d: %16LX %16LX %16LX %31a %31a %5d\n"\r
-#string STR_DP_RAW_HEADR2 #language en-US "\nIndex Handle Start Count End Count Token Module ID\n"\r
- #language fr-FR "\nIndex Handle Start Count End Count Token Module ID\n"\r
-#string STR_DP_OPTION_UA #language en-US "-A"\r
- #language fr-FR "-A"\r
-#string STR_DP_OPTION_LA #language en-US "-a"\r
- #language fr-FR "-a"\r
-#string STR_DP_OPTION_LN #language en-US "-n"\r
- #language fr-FR "-n"\r
-#string STR_DP_OPTION_LT #language en-US "-t"\r
- #language fr-FR "-t"\r
-#string STR_DP_OPTION_UP #language en-US "-P"\r
- #language fr-FR "-P"\r
-#string STR_DP_OPTION_UR #language en-US "-R"\r
- #language fr-FR "-R"\r
-#string STR_DP_OPTION_LS #language en-US "-s"\r
- #language fr-FR "-s"\r
-#string STR_DP_OPTION_US #language en-US "-S"\r
- #language fr-FR "-S"\r
-#string STR_DP_OPTION_UT #language en-US "-T"\r
- #language fr-FR "-T"\r
-#string STR_DP_OPTION_LV #language en-US "-v"\r
- #language fr-FR "-v"\r
-#string STR_DP_OPTION_QH #language en-US "-?"\r
- #language fr-FR "-?"\r
-#string STR_DP_OPTION_LH #language en-US "-h"\r
- #language fr-FR "-h"\r
-#string STR_DP_OPTION_UH #language en-US "-H"\r
- #language fr-FR "-H"\r
-#string STR_DP_OPTION_LX #language en-US "-x"\r
- #language fr-FR "-x"\r
-#string STR_DP_OPTION_LI #language en-US "-i"\r
- #language fr-FR "-i"\r
-#string STR_DP_OPTION_LC #language en-US "-c"\r
- #language fr-FR "-c"\r
-#string STR_DP_INCOMPLETE #language en-US " I "\r
- #language fr-FR " I "\r
-#string STR_DP_COMPLETE #language en-US " "\r
- #language fr-FR " "\r
-#string STR_ALIT_UNKNOWN #language en-US "Unknown"\r
- #language fr-FR "Unknown"
\ No newline at end of file
+++ /dev/null
-/** @file\r
- Trace reporting for the Dp utility.\r
-\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
- (C) Copyright 2015-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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/PerformanceLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-#include <Guid/Performance.h>\r
-\r
-#include "Dp.h"\r
-#include "Literals.h"\r
-#include "DpInternal.h"\r
-\r
-/** \r
- Collect verbose statistics about the logged performance measurements.\r
- \r
- General Summary information for all Trace measurements is gathered and\r
- stored within the SummaryData structure. This information is both\r
- used internally by subsequent reporting functions, and displayed\r
- at the end of verbose reports.\r
- \r
- @pre The SummaryData and CumData structures must be initialized\r
- prior to calling this function.\r
- \r
- @post The SummaryData and CumData structures contain statistics for the\r
- current performance logs.\r
-\r
- @param[in, out] CustomCumulativeData A pointer to the cumtom cumulative data.\r
-\r
-**/\r
-VOID\r
-GatherStatistics(\r
- IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r
- )\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 Duration;\r
- UINTN LogEntryKey;\r
- INTN TIndex;\r
-\r
- LogEntryKey = 0;\r
- while ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- {\r
- ++SummaryData.NumTrace; // Count the number of TRACE Measurement records\r
- if (Measurement.EndTimeStamp == 0) {\r
- ++SummaryData.NumIncomplete; // Count the incomplete records\r
- continue;\r
- }\r
-\r
- if (Measurement.Handle != NULL) {\r
- ++SummaryData.NumHandles; // Count the number of measurements with non-NULL handles\r
- }\r
-\r
- if (IsPhase( &Measurement)) {\r
- ++SummaryData.NumSummary; // Count the number of major phases\r
- }\r
- else { // !IsPhase(...\r
- if(Measurement.Handle == NULL) {\r
- ++SummaryData.NumGlobal;\r
- }\r
- }\r
-\r
- if (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) == 0) {\r
- ++SummaryData.NumPEIMs; // Count PEIM measurements\r
- }\r
-\r
- Duration = GetDuration (&Measurement);\r
- TIndex = GetCumulativeItem (&Measurement);\r
- if (TIndex >= 0) {\r
- CumData[TIndex].Duration += Duration;\r
- CumData[TIndex].Count++;\r
- if ( Duration < CumData[TIndex].MinDur ) {\r
- CumData[TIndex].MinDur = Duration;\r
- }\r
- if ( Duration > CumData[TIndex].MaxDur ) {\r
- CumData[TIndex].MaxDur = Duration;\r
- }\r
- }\r
-\r
- //\r
- // Collect the data for custom cumulative data.\r
- //\r
- if ((CustomCumulativeData != NULL) && (AsciiStrCmp (Measurement.Token, CustomCumulativeData->Name) == 0)) {\r
- CustomCumulativeData->Duration += Duration;\r
- CustomCumulativeData->Count++;\r
- if (Duration < CustomCumulativeData->MinDur) {\r
- CustomCumulativeData->MinDur = Duration;\r
- }\r
- if (Duration > CustomCumulativeData->MaxDur) {\r
- CustomCumulativeData->MaxDur = Duration;\r
- }\r
- }\r
- }\r
-}\r
-\r
-/** \r
- Gather and print ALL Trace Records.\r
- \r
- Displays all "interesting" Trace measurements in order.<BR>\r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
- They must not be in use by a calling function.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
- \r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
- @return Others from a call to gBS->LocateHandleBuffer().\r
-**/\r
-EFI_STATUS\r
-DumpAllTrace(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- )\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 ElapsedTime;\r
- UINT64 Duration;\r
- const CHAR16 *IncFlag;\r
- UINTN LogEntryKey;\r
- UINTN Count;\r
- UINTN Index;\r
- UINTN TIndex;\r
-\r
- EFI_HANDLE *HandleBuffer;\r
- UINTN HandleCount;\r
- EFI_STATUS Status;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (IncFlag == NULL) ? StringPtrUnknown : IncFlag);\r
- FreePool (StringPtrUnknown);\r
-\r
- // Get Handle information\r
- //\r
- Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);\r
- if (EFI_ERROR (Status)) {\r
- PrintToken (STRING_TOKEN (STR_DP_HANDLES_ERROR), Status);\r
- }\r
- else {\r
- // We have successfully populated the HandleBuffer\r
- // Display ALL Measurement Records\r
- // Up to Limit lines displayed\r
- // Display only records with Elapsed times >= mInterestThreshold\r
- // Display driver names in Module field for records with Handles.\r
- //\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_ALL_HEADR2) );\r
- PrintToken (STRING_TOKEN (STR_DP_ALL_DASHES2) );\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_ALL_HEADR) );\r
- PrintToken (STRING_TOKEN (STR_DP_DASHES) );\r
- }\r
-\r
- LogEntryKey = 0;\r
- Count = 0;\r
- Index = 0;\r
- while ( WITHIN_LIMIT(Count, Limit) &&\r
- ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- )\r
- {\r
- ++Index; // Count every record. First record is 1.\r
- ElapsedTime = 0;\r
- SafeFreePool ((VOID *) IncFlag);\r
- if (Measurement.EndTimeStamp != 0) {\r
- Duration = GetDuration (&Measurement);\r
- ElapsedTime = DurationInMicroSeconds ( Duration );\r
- IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);\r
- }\r
- else {\r
- IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records\r
- }\r
- if (((Measurement.EndTimeStamp != 0) && (ElapsedTime < mInterestThreshold)) ||\r
- ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
- ) { // Ignore "uninteresting" or excluded records\r
- continue;\r
- }\r
- ++Count; // Count the number of records printed\r
-\r
- // If Handle is non-zero, see if we can determine a name for the driver\r
- AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString)); // Use Module by default\r
- AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));\r
- if (Measurement.Handle != NULL) {\r
- // See if the Handle is in the HandleBuffer\r
- for (TIndex = 0; TIndex < HandleCount; TIndex++) {\r
- if (Measurement.Handle == HandleBuffer[TIndex]) {\r
- GetNameFromHandle (HandleBuffer[TIndex]);\r
- break;\r
- }\r
- }\r
- }\r
-\r
- if (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) == 0) {\r
- UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", Measurement.Handle);\r
- }\r
-\r
- // Ensure that the argument strings are not too long.\r
- mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
- mUnicodeToken[13] = 0;\r
-\r
- if (mShowId) {\r
- PrintToken( STRING_TOKEN (STR_DP_ALL_VARS2),\r
- Index, // 1 based, Which measurement record is being printed\r
- IncFlag,\r
- Measurement.Handle,\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime,\r
- Measurement.Identifier\r
- );\r
- } else {\r
- PrintToken( STRING_TOKEN (STR_DP_ALL_VARS),\r
- Index, // 1 based, Which measurement record is being printed\r
- IncFlag,\r
- Measurement.Handle,\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime\r
- );\r
- }\r
- if (ShellGetExecutionBreakFlag ()) {\r
- Status = EFI_ABORTED;\r
- break;\r
- }\r
- }\r
- }\r
- if (HandleBuffer != NULL) {\r
- FreePool (HandleBuffer);\r
- }\r
- SafeFreePool ((VOID *) IncFlag);\r
- return Status;\r
-}\r
-\r
-/** \r
- Gather and print Raw Trace Records.\r
- \r
- All Trace measurements with a duration greater than or equal to\r
- mInterestThreshold are printed without interpretation.\r
- \r
- The number of records displayed is controlled by:\r
- - records with a duration less than mInterestThreshold microseconds are not displayed.\r
- - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
- - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
- displayed.\r
- \r
- @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
- \r
- @param[in] Limit The number of records to print. Zero is ALL.\r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-DumpRawTrace(\r
- IN UINTN Limit,\r
- IN BOOLEAN ExcludeFlag\r
- )\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 ElapsedTime;\r
- UINT64 Duration;\r
- UINTN LogEntryKey;\r
- UINTN Count;\r
- UINTN Index;\r
-\r
- EFI_STRING StringPtr;\r
- EFI_STRING StringPtrUnknown;\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR2) );\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES2) );\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR) );\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES) );\r
- }\r
-\r
- LogEntryKey = 0;\r
- Count = 0;\r
- Index = 0;\r
- while ( WITHIN_LIMIT(Count, Limit) &&\r
- ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- )\r
- {\r
- ++Index; // Count every record. First record is 1.\r
- ElapsedTime = 0;\r
- if (Measurement.EndTimeStamp != 0) {\r
- Duration = GetDuration (&Measurement);\r
- ElapsedTime = DurationInMicroSeconds ( Duration );\r
- }\r
- if ((ElapsedTime < mInterestThreshold) ||\r
- ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
- ) { // Ignore "uninteresting" or Excluded records\r
- continue;\r
- }\r
- ++Count; // Count the number of records printed\r
-\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_VARS2),\r
- Index, // 1 based, Which measurement record is being printed\r
- Measurement.Handle,\r
- Measurement.StartTimeStamp,\r
- Measurement.EndTimeStamp,\r
- Measurement.Token,\r
- Measurement.Module,\r
- Measurement.Identifier\r
- );\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_RAW_VARS),\r
- Index, // 1 based, Which measurement record is being printed\r
- Measurement.Handle,\r
- Measurement.StartTimeStamp,\r
- Measurement.EndTimeStamp,\r
- Measurement.Token,\r
- Measurement.Module\r
- );\r
- }\r
- if (ShellGetExecutionBreakFlag ()) {\r
- Status = EFI_ABORTED;\r
- break;\r
- }\r
- }\r
- return Status;\r
-}\r
-\r
-/** \r
- Gather and print Major Phase metrics.\r
- \r
-**/\r
-VOID\r
-ProcessPhases(\r
- VOID\r
- )\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 BdsTimeoutValue;\r
- UINT64 SecTime;\r
- UINT64 PeiTime;\r
- UINT64 DxeTime;\r
- UINT64 BdsTime;\r
- UINT64 ElapsedTime;\r
- UINT64 Duration;\r
- UINT64 Total;\r
- EFI_STRING StringPtr;\r
- UINTN LogEntryKey;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- BdsTimeoutValue = 0;\r
- SecTime = 0;\r
- PeiTime = 0;\r
- DxeTime = 0;\r
- BdsTime = 0;\r
- //\r
- // Get Execution Phase Statistics\r
- //\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- LogEntryKey = 0;\r
- while ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- {\r
- if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records\r
- continue;\r
- }\r
- Duration = GetDuration (&Measurement);\r
- if ( Measurement.Handle != NULL\r
- && (AsciiStrnCmp (Measurement.Token, ALit_BdsTO, PERF_TOKEN_LENGTH) == 0)\r
- )\r
- {\r
- BdsTimeoutValue = Duration;\r
- } else if (AsciiStrnCmp (Measurement.Token, ALit_SEC, PERF_TOKEN_LENGTH) == 0) {\r
- SecTime = Duration;\r
- } else if (AsciiStrnCmp (Measurement.Token, ALit_PEI, PERF_TOKEN_LENGTH) == 0) {\r
- PeiTime = Duration;\r
- } else if (AsciiStrnCmp (Measurement.Token, ALit_DXE, PERF_TOKEN_LENGTH) == 0) {\r
- DxeTime = Duration;\r
- } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0) {\r
- BdsTime = Duration;\r
- }\r
- }\r
-\r
- Total = 0;\r
-\r
- // print SEC phase duration time\r
- //\r
- if (SecTime > 0) {\r
- ElapsedTime = DurationInMicroSeconds ( SecTime ); // Calculate elapsed time in microseconds\r
- Total += DivU64x32 (ElapsedTime, 1000); // Accumulate time in milliseconds\r
- PrintToken (STRING_TOKEN (STR_DP_SEC_PHASE), ElapsedTime);\r
- }\r
-\r
- // print PEI phase duration time\r
- //\r
- if (PeiTime > 0) {\r
- ElapsedTime = DivU64x32 (\r
- PeiTime,\r
- (UINT32)TimerInfo.Frequency\r
- );\r
- Total += ElapsedTime;\r
- PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_PEI, ElapsedTime);\r
- }\r
-\r
- // print DXE phase duration time\r
- //\r
- if (DxeTime > 0) {\r
- ElapsedTime = DivU64x32 (\r
- DxeTime,\r
- (UINT32)TimerInfo.Frequency\r
- );\r
- Total += ElapsedTime;\r
- PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_DXE, ElapsedTime);\r
- }\r
-\r
- // print BDS phase duration time\r
- //\r
- if (BdsTime > 0) {\r
- ElapsedTime = DivU64x32 (\r
- BdsTime,\r
- (UINT32)TimerInfo.Frequency\r
- );\r
- Total += ElapsedTime;\r
- PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_BDS, ElapsedTime);\r
- }\r
-\r
- if (BdsTimeoutValue > 0) {\r
- ElapsedTime = DivU64x32 (\r
- BdsTimeoutValue,\r
- (UINT32)TimerInfo.Frequency\r
- );\r
- PrintToken (STRING_TOKEN (STR_DP_PHASE_BDSTO), ALit_BdsTO, ElapsedTime);\r
- }\r
-\r
- PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);\r
-}\r
-\r
-/** \r
- Gather and print Handle data.\r
- \r
- @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
- @return Others from a call to gBS->LocateHandleBuffer().\r
-**/\r
-EFI_STATUS\r
-ProcessHandles(\r
- IN BOOLEAN ExcludeFlag\r
- )\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 ElapsedTime;\r
- UINT64 Duration;\r
- EFI_HANDLE *HandleBuffer;\r
- EFI_STRING StringPtr;\r
- UINTN Index;\r
- UINTN LogEntryKey;\r
- UINTN Count;\r
- UINTN HandleCount;\r
- EFI_STATUS Status;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount, &HandleBuffer);\r
- if (EFI_ERROR (Status)) {\r
- PrintToken (STRING_TOKEN (STR_DP_HANDLES_ERROR), Status);\r
- }\r
- else {\r
-#if DP_DEBUG == 2\r
- Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0])));\r
-#endif\r
-\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_HANDLE_SECTION2) );\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_HANDLE_SECTION) );\r
- }\r
- PrintToken (STRING_TOKEN (STR_DP_DASHES) );\r
-\r
- LogEntryKey = 0;\r
- Count = 0;\r
- while ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- {\r
- Count++;\r
- Duration = GetDuration (&Measurement);\r
- ElapsedTime = DurationInMicroSeconds ( Duration );\r
- if ((ElapsedTime < mInterestThreshold) ||\r
- (Measurement.EndTimeStamp == 0) ||\r
- (Measurement.Handle == NULL) ||\r
- ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))\r
- ) { // Ignore "uninteresting" or excluded records\r
- continue;\r
- }\r
- mGaugeString[0] = 0; // Empty driver name by default\r
- AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));\r
- // See if the Handle is in the HandleBuffer\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- if (Measurement.Handle == HandleBuffer[Index]) {\r
- GetNameFromHandle (HandleBuffer[Index]); // Name is put into mGaugeString\r
- break;\r
- }\r
- }\r
- // Ensure that the argument strings are not too long.\r
- mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r
- mUnicodeToken[11] = 0;\r
- if (mGaugeString[0] != 0) {\r
- // Display the record if it has a valid handle.\r
- if (mShowId) {\r
- PrintToken (\r
- STRING_TOKEN (STR_DP_HANDLE_VARS2),\r
- Count, // 1 based, Which measurement record is being printed\r
- Index + 1, // 1 based, Which handle is being printed\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime,\r
- Measurement.Identifier\r
- );\r
- } else {\r
- PrintToken (\r
- STRING_TOKEN (STR_DP_HANDLE_VARS),\r
- Count, // 1 based, Which measurement record is being printed\r
- Index + 1, // 1 based, Which handle is being printed\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime\r
- );\r
- }\r
- }\r
- if (ShellGetExecutionBreakFlag ()) {\r
- Status = EFI_ABORTED;\r
- break;\r
- }\r
- }\r
- }\r
- if (HandleBuffer != NULL) {\r
- FreePool (HandleBuffer);\r
- }\r
- return Status;\r
-}\r
-\r
-/** \r
- Gather and print PEIM data.\r
- \r
- Only prints complete PEIM records\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-ProcessPeims(\r
- VOID\r
-)\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 Duration;\r
- UINT64 ElapsedTime;\r
- EFI_STRING StringPtr;\r
- UINTN LogEntryKey;\r
- UINTN TIndex;\r
- EFI_STRING StringPtrUnknown;\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown : StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION2));\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION));\r
- }\r
- PrintToken (STRING_TOKEN (STR_DP_DASHES));\r
- TIndex = 0;\r
- LogEntryKey = 0;\r
- while ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- {\r
- TIndex++;\r
- if ((Measurement.EndTimeStamp == 0) ||\r
- (AsciiStrnCmp (Measurement.Token, ALit_PEIM, PERF_TOKEN_LENGTH) != 0)\r
- ) {\r
- continue;\r
- }\r
-\r
- Duration = GetDuration (&Measurement);\r
- ElapsedTime = DurationInMicroSeconds ( Duration ); // Calculate elapsed time in microseconds\r
- if (ElapsedTime >= mInterestThreshold) {\r
- // PEIM FILE Handle is the start address of its FFS file that contains its file guid.\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_PEIM_VARS2),\r
- TIndex, // 1 based, Which measurement record is being printed\r
- Measurement.Handle, // base address\r
- Measurement.Handle, // file guid\r
- ElapsedTime,\r
- Measurement.Identifier\r
- );\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_PEIM_VARS),\r
- TIndex, // 1 based, Which measurement record is being printed\r
- Measurement.Handle, // base address\r
- Measurement.Handle, // file guid\r
- ElapsedTime\r
- );\r
- }\r
- }\r
- if (ShellGetExecutionBreakFlag ()) {\r
- Status = EFI_ABORTED;\r
- break;\r
- }\r
- }\r
- return Status;\r
-}\r
-\r
-/** \r
- Gather and print global data.\r
- \r
- Strips out incomplete or "Execution Phase" records\r
- Only prints records where Handle is NULL\r
- Increment TIndex for every record, even skipped ones, so that we have an\r
- indication of every measurement record taken.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_ABORTED The user aborts the operation.\r
-**/\r
-EFI_STATUS\r
-ProcessGlobal(\r
- VOID\r
-)\r
-{\r
- MEASUREMENT_RECORD Measurement;\r
- UINT64 Duration;\r
- UINT64 ElapsedTime;\r
- EFI_STRING StringPtr;\r
- UINTN LogEntryKey;\r
- UINTN Index; // Index, or number, of the measurement record being processed\r
- EFI_STRING StringPtrUnknown;\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- if (mShowId) {\r
- PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION2));\r
- } else {\r
- PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION));\r
- }\r
- PrintToken (STRING_TOKEN (STR_DP_DASHES));\r
-\r
- Index = 1;\r
- LogEntryKey = 0;\r
-\r
- while ((LogEntryKey = GetPerformanceMeasurementEx (\r
- LogEntryKey,\r
- &Measurement.Handle,\r
- &Measurement.Token,\r
- &Measurement.Module,\r
- &Measurement.StartTimeStamp,\r
- &Measurement.EndTimeStamp,\r
- &Measurement.Identifier)) != 0)\r
- {\r
- AsciiStrToUnicodeStrS (Measurement.Module, mGaugeString, ARRAY_SIZE (mGaugeString));\r
- AsciiStrToUnicodeStrS (Measurement.Token, mUnicodeToken, ARRAY_SIZE (mUnicodeToken));\r
- mGaugeString[25] = 0;\r
- mUnicodeToken[31] = 0;\r
- if ( ! ( IsPhase( &Measurement) ||\r
- (Measurement.Handle != NULL) ||\r
- (Measurement.EndTimeStamp == 0)\r
- ))\r
- {\r
- Duration = GetDuration (&Measurement);\r
- ElapsedTime = DurationInMicroSeconds ( Duration );\r
- if (ElapsedTime >= mInterestThreshold) {\r
- if (mShowId) {\r
- PrintToken (\r
- STRING_TOKEN (STR_DP_GLOBAL_VARS2),\r
- Index,\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime,\r
- Measurement.Identifier\r
- );\r
- } else {\r
- PrintToken (\r
- STRING_TOKEN (STR_DP_GLOBAL_VARS),\r
- Index,\r
- mGaugeString,\r
- mUnicodeToken,\r
- ElapsedTime\r
- );\r
- }\r
- }\r
- }\r
- if (ShellGetExecutionBreakFlag ()) {\r
- Status = EFI_ABORTED;\r
- break;\r
- }\r
- Index++;\r
- }\r
- return Status;\r
-}\r
-\r
-/** \r
- Gather and print cumulative data.\r
- \r
- Traverse the measurement records and:<BR>\r
- For each record with a Token listed in the CumData array:<BR>\r
- - Update the instance count and the total, minimum, and maximum durations.\r
- Finally, print the gathered cumulative statistics.\r
-\r
- @param[in] CustomCumulativeData A pointer to the cumtom cumulative data.\r
-\r
-**/\r
-VOID\r
-ProcessCumulative(\r
- IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r
- )\r
-{\r
- UINT64 AvgDur; // the computed average duration\r
- UINT64 Dur;\r
- UINT64 MinDur;\r
- UINT64 MaxDur;\r
- EFI_STRING StringPtr;\r
- UINTN TIndex;\r
- EFI_STRING StringPtrUnknown;\r
-\r
- StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);\r
- PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
- (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
- FreePool (StringPtr);\r
- FreePool (StringPtrUnknown);\r
-\r
- PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_1));\r
- PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_2));\r
- PrintToken (STRING_TOKEN (STR_DP_DASHES));\r
-\r
- for ( TIndex = 0; TIndex < NumCum; ++TIndex) {\r
- if (CumData[TIndex].Count != 0) {\r
- AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);\r
- AvgDur = DurationInMicroSeconds(AvgDur);\r
- Dur = DurationInMicroSeconds(CumData[TIndex].Duration);\r
- MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur);\r
- MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur);\r
- \r
- PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),\r
- CumData[TIndex].Name,\r
- CumData[TIndex].Count,\r
- Dur,\r
- AvgDur,\r
- MinDur,\r
- MaxDur\r
- );\r
- }\r
- }\r
-\r
- //\r
- // Print the custom cumulative data.\r
- //\r
- if (CustomCumulativeData != NULL) {\r
- if (CustomCumulativeData->Count != 0) {\r
- AvgDur = DivU64x32 (CustomCumulativeData->Duration, CustomCumulativeData->Count);\r
- AvgDur = DurationInMicroSeconds (AvgDur);\r
- Dur = DurationInMicroSeconds (CustomCumulativeData->Duration);\r
- MaxDur = DurationInMicroSeconds (CustomCumulativeData->MaxDur);\r
- MinDur = DurationInMicroSeconds (CustomCumulativeData->MinDur);\r
- } else {\r
- AvgDur = 0;\r
- Dur = 0;\r
- MaxDur = 0;\r
- MinDur = 0;\r
- }\r
- PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),\r
- CustomCumulativeData->Name,\r
- CustomCumulativeData->Count,\r
- Dur,\r
- AvgDur,\r
- MinDur,\r
- MaxDur\r
- );\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- Utility functions used by the Dp application.\r
-\r
- Copyright (c) 2009 - 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
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-\r
-#include <Pi/PiFirmwareFile.h>\r
-#include <Library/DxeServicesLib.h>\r
-\r
-#include <Protocol/LoadedImage.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/ComponentName2.h>\r
-#include <Protocol/DevicePath.h>\r
-\r
-#include <Guid/Performance.h>\r
-\r
-#include "Dp.h"\r
-#include "Literals.h"\r
-#include "DpInternal.h"\r
-\r
-/**\r
- Wrap original FreePool to check NULL pointer first.\r
-\r
- @param[in] Buffer The pointer to the buffer to free.\r
-\r
-**/\r
-VOID\r
-SafeFreePool (\r
- IN VOID *Buffer\r
- )\r
-{\r
- if (Buffer != NULL) {\r
- FreePool (Buffer);\r
- }\r
-}\r
-\r
-/** \r
- Calculate an event's duration in timer ticks.\r
- \r
- Given the count direction and the event's start and end timer values,\r
- calculate the duration of the event in timer ticks. Information for\r
- the current measurement is pointed to by the parameter.\r
- \r
- If the measurement's start time is 1, it indicates that the developer\r
- is indicating that the measurement began at the release of reset.\r
- The start time is adjusted to the timer's starting count before performing\r
- the elapsed time calculation.\r
- \r
- The calculated duration, in ticks, is the absolute difference between\r
- the measurement's ending and starting counts.\r
- \r
- @param Measurement Pointer to a MEASUREMENT_RECORD structure containing\r
- data for the current measurement.\r
- \r
- @return The 64-bit duration of the event.\r
-**/\r
-UINT64\r
-GetDuration (\r
- IN OUT MEASUREMENT_RECORD *Measurement\r
- )\r
-{\r
- UINT64 Duration;\r
- BOOLEAN Error;\r
-\r
- if (Measurement->EndTimeStamp == 0) {\r
- return 0;\r
- }\r
-\r
- // PERF_START macros are called with a value of 1 to indicate\r
- // the beginning of time. So, adjust the start ticker value\r
- // to the real beginning of time.\r
- // Assumes no wraparound. Even then, there is a very low probability\r
- // of having a valid StartTicker value of 1.\r
- if (Measurement->StartTimeStamp == 1) {\r
- Measurement->StartTimeStamp = TimerInfo.StartCount;\r
- }\r
- if (TimerInfo.CountUp) {\r
- Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;\r
- Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);\r
- }\r
- else {\r
- Duration = Measurement->StartTimeStamp - Measurement->EndTimeStamp;\r
- Error = (BOOLEAN)(Duration > Measurement->StartTimeStamp);\r
- }\r
-\r
- if (Error) {\r
- DEBUG ((EFI_D_ERROR, ALit_TimerLibError));\r
- Duration = 0;\r
- }\r
- return Duration;\r
-}\r
-\r
-/** \r
- Determine whether the Measurement record is for an EFI Phase.\r
- \r
- The Token and Module members of the measurement record are checked.\r
- Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.\r
- \r
- @param[in] Measurement A pointer to the Measurement record to test.\r
- \r
- @retval TRUE The measurement record is for an EFI Phase.\r
- @retval FALSE The measurement record is NOT for an EFI Phase.\r
-**/\r
-BOOLEAN\r
-IsPhase(\r
- IN MEASUREMENT_RECORD *Measurement\r
- )\r
-{\r
- BOOLEAN RetVal;\r
-\r
- RetVal = (BOOLEAN)( ( *Measurement->Module == '\0') &&\r
- ((AsciiStrnCmp (Measurement->Token, ALit_SEC, PERF_TOKEN_LENGTH) == 0) ||\r
- (AsciiStrnCmp (Measurement->Token, ALit_PEI, PERF_TOKEN_LENGTH) == 0) ||\r
- (AsciiStrnCmp (Measurement->Token, ALit_DXE, PERF_TOKEN_LENGTH) == 0) ||\r
- (AsciiStrnCmp (Measurement->Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0))\r
- );\r
- return RetVal;\r
-}\r
-\r
-/** \r
- Get the file name portion of the Pdb File Name.\r
- \r
- The portion of the Pdb File Name between the last backslash and\r
- either a following period or the end of the string is converted\r
- to Unicode and copied into UnicodeBuffer. The name is truncated,\r
- if necessary, to ensure that UnicodeBuffer is not overrun.\r
- \r
- @param[in] PdbFileName Pdb file name.\r
- @param[out] UnicodeBuffer The resultant Unicode File Name.\r
- \r
-**/\r
-VOID\r
-GetShortPdbFileName (\r
- IN CHAR8 *PdbFileName,\r
- OUT CHAR16 *UnicodeBuffer\r
- )\r
-{\r
- UINTN IndexA; // Current work location within an ASCII string.\r
- UINTN IndexU; // Current work location within a Unicode string.\r
- UINTN StartIndex;\r
- UINTN EndIndex;\r
-\r
- ZeroMem (UnicodeBuffer, (DP_GAUGE_STRING_LENGTH + 1) * sizeof (CHAR16));\r
-\r
- if (PdbFileName == NULL) {\r
- StrCpyS (UnicodeBuffer, DP_GAUGE_STRING_LENGTH + 1, L" ");\r
- } else {\r
- StartIndex = 0;\r
- for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
- ;\r
- for (IndexA = 0; PdbFileName[IndexA] != 0; IndexA++) {\r
- if ((PdbFileName[IndexA] == '\\') || (PdbFileName[IndexA] == '/')) {\r
- StartIndex = IndexA + 1;\r
- }\r
-\r
- if (PdbFileName[IndexA] == '.') {\r
- EndIndex = IndexA;\r
- }\r
- }\r
-\r
- IndexU = 0;\r
- for (IndexA = StartIndex; IndexA < EndIndex; IndexA++) {\r
- UnicodeBuffer[IndexU] = (CHAR16) PdbFileName[IndexA];\r
- IndexU++;\r
- if (IndexU >= DP_GAUGE_STRING_LENGTH) {\r
- UnicodeBuffer[DP_GAUGE_STRING_LENGTH] = 0;\r
- break;\r
- }\r
- }\r
- }\r
-}\r
-\r
-/** \r
- Get a human readable name for an image handle.\r
- The following methods will be tried orderly:\r
- 1. Image PDB\r
- 2. ComponentName2 protocol\r
- 3. FFS UI section\r
- 4. Image GUID\r
- 5. Image DevicePath\r
- 6. Unknown Driver Name\r
-\r
- @param[in] Handle\r
-\r
- @post The resulting Unicode name string is stored in the\r
- mGaugeString global array.\r
-\r
-**/\r
-VOID\r
-GetNameFromHandle (\r
- IN EFI_HANDLE Handle\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_LOADED_IMAGE_PROTOCOL *Image;\r
- CHAR8 *PdbFileName;\r
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
- EFI_STRING StringPtr;\r
- EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
- EFI_GUID *NameGuid;\r
- CHAR16 *NameString;\r
- UINTN StringSize;\r
- CHAR8 *PlatformLanguage;\r
- CHAR8 *BestLanguage;\r
- EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;\r
-\r
- Image = NULL;\r
- LoadedImageDevicePath = NULL;\r
- DevicePath = NULL;\r
- BestLanguage = NULL;\r
- PlatformLanguage = NULL;\r
-\r
- //\r
- // Method 1: Get the name string from image PDB\r
- //\r
- Status = gBS->HandleProtocol (\r
- Handle,\r
- &gEfiLoadedImageProtocolGuid,\r
- (VOID **) &Image\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- Status = gBS->OpenProtocol (\r
- Handle,\r
- &gEfiDriverBindingProtocolGuid,\r
- (VOID **) &DriverBinding,\r
- NULL,\r
- NULL,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- Status = gBS->HandleProtocol (\r
- DriverBinding->ImageHandle,\r
- &gEfiLoadedImageProtocolGuid,\r
- (VOID **) &Image\r
- );\r
- }\r
- }\r
-\r
- if (!EFI_ERROR (Status)) {\r
- PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);\r
-\r
- if (PdbFileName != NULL) {\r
- GetShortPdbFileName (PdbFileName, mGaugeString);\r
- return;\r
- }\r
- }\r
-\r
- //\r
- // Method 2: Get the name string from ComponentName2 protocol\r
- //\r
- Status = gBS->HandleProtocol (\r
- Handle,\r
- &gEfiComponentName2ProtocolGuid,\r
- (VOID **) &ComponentName2\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Get the current platform language setting\r
- //\r
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);\r
-\r
- BestLanguage = GetBestLanguage(\r
- ComponentName2->SupportedLanguages,\r
- FALSE,\r
- PlatformLanguage,\r
- ComponentName2->SupportedLanguages,\r
- NULL\r
- );\r
-\r
- SafeFreePool (PlatformLanguage);\r
- Status = ComponentName2->GetDriverName (\r
- ComponentName2,\r
- BestLanguage,\r
- &StringPtr\r
- );\r
- SafeFreePool (BestLanguage);\r
- if (!EFI_ERROR (Status)) {\r
- StrnCpyS (\r
- mGaugeString,\r
- DP_GAUGE_STRING_LENGTH + 1,\r
- StringPtr,\r
- DP_GAUGE_STRING_LENGTH\r
- );\r
- return;\r
- }\r
- }\r
-\r
- Status = gBS->HandleProtocol (\r
- Handle,\r
- &gEfiLoadedImageDevicePathProtocolGuid,\r
- (VOID **) &LoadedImageDevicePath\r
- );\r
- if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {\r
- DevicePath = LoadedImageDevicePath;\r
- } else if (Image != NULL) {\r
- DevicePath = Image->FilePath;\r
- }\r
-\r
- if (DevicePath != NULL) {\r
- //\r
- // Try to get image GUID from image DevicePath\r
- //\r
- NameGuid = NULL;\r
- while (!IsDevicePathEndType (DevicePath)) {\r
- NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);\r
- if (NameGuid != NULL) {\r
- break;\r
- }\r
- DevicePath = NextDevicePathNode (DevicePath);\r
- }\r
-\r
- if (NameGuid != NULL) {\r
- //\r
- // Try to get the image's FFS UI section by image GUID\r
- //\r
- NameString = NULL;\r
- StringSize = 0;\r
- Status = GetSectionFromAnyFv (\r
- NameGuid,\r
- EFI_SECTION_USER_INTERFACE,\r
- 0,\r
- (VOID **) &NameString,\r
- &StringSize\r
- );\r
-\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Method 3. Get the name string from FFS UI section\r
- //\r
- StrnCpyS (\r
- mGaugeString,\r
- DP_GAUGE_STRING_LENGTH + 1,\r
- NameString,\r
- DP_GAUGE_STRING_LENGTH\r
- );\r
- FreePool (NameString);\r
- } else {\r
- //\r
- // Method 4: Get the name string from image GUID\r
- //\r
- UnicodeSPrint (mGaugeString, sizeof (mGaugeString), L"%g", NameGuid);\r
- }\r
- return;\r
- } else {\r
- //\r
- // Method 5: Get the name string from image DevicePath\r
- //\r
- NameString = ConvertDevicePathToText (DevicePath, TRUE, FALSE);\r
- if (NameString != NULL) {\r
- StrnCpyS (\r
- mGaugeString,\r
- DP_GAUGE_STRING_LENGTH + 1,\r
- NameString,\r
- DP_GAUGE_STRING_LENGTH\r
- );\r
- FreePool (NameString);\r
- return;\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Method 6: Unknown Driver Name\r
- //\r
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);\r
- ASSERT (StringPtr != NULL);\r
- StrCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr);\r
- FreePool (StringPtr);\r
- return;\r
-}\r
-\r
-/** \r
- Calculate the Duration in microseconds.\r
- \r
- Duration is multiplied by 1000, instead of Frequency being divided by 1000 or\r
- multiplying the result by 1000, in order to maintain precision. Since Duration is\r
- a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.\r
- \r
- The time is calculated as (Duration * 1000) / Timer_Frequency.\r
- \r
- @param[in] Duration The event duration in timer ticks.\r
- \r
- @return A 64-bit value which is the Elapsed time in microseconds.\r
-**/\r
-UINT64\r
-DurationInMicroSeconds (\r
- IN UINT64 Duration\r
- )\r
-{\r
- UINT64 Temp;\r
-\r
- Temp = MultU64x32 (Duration, 1000);\r
- return DivU64x32 (Temp, TimerInfo.Frequency);\r
-}\r
-\r
-/** \r
- Formatted Print using a Hii Token to reference the localized format string.\r
- \r
- @param[in] Token A HII token associated with a localized Unicode string.\r
- @param[in] ... The variable argument list.\r
- \r
- @return The number of characters converted by UnicodeVSPrint().\r
- \r
-**/\r
-UINTN\r
-EFIAPI\r
-PrintToken (\r
- IN UINT16 Token,\r
- ...\r
- )\r
-{\r
- VA_LIST Marker;\r
- EFI_STRING StringPtr;\r
- UINTN Return;\r
- UINTN BufferSize;\r
-\r
- StringPtr = HiiGetString (gHiiHandle, Token, NULL);\r
- ASSERT (StringPtr != NULL);\r
-\r
- VA_START (Marker, Token);\r
-\r
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
-\r
- if (mPrintTokenBuffer == NULL) {\r
- mPrintTokenBuffer = AllocatePool (BufferSize);\r
- ASSERT (mPrintTokenBuffer != NULL);\r
- }\r
- SetMem( mPrintTokenBuffer, BufferSize, 0);\r
-\r
- Return = UnicodeVSPrint (mPrintTokenBuffer, BufferSize, StringPtr, Marker);\r
- VA_END (Marker);\r
- \r
- if (Return > 0 && gST->ConOut != NULL) {\r
- gST->ConOut->OutputString (gST->ConOut, mPrintTokenBuffer);\r
- }\r
- FreePool (StringPtr);\r
- return Return;\r
-}\r
-\r
-/** \r
- Get index of Measurement Record's match in the CumData array.\r
- \r
- If the Measurement's Token value matches a Token in one of the CumData\r
- records, the index of the matching record is returned. The returned\r
- index is a signed value so that negative values can indicate that\r
- the Measurement didn't match any entry in the CumData array.\r
- \r
- @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.\r
- \r
- @retval <0 Token is not in the CumData array.\r
- @retval >=0 Return value is the index into CumData where Token is found.\r
-**/\r
-INTN\r
-GetCumulativeItem(\r
- IN MEASUREMENT_RECORD *Measurement\r
- )\r
-{\r
- INTN Index;\r
-\r
- for( Index = 0; Index < (INTN)NumCum; ++Index) {\r
- if (AsciiStrnCmp (Measurement->Token, CumData[Index].Name, PERF_TOKEN_LENGTH) == 0) {\r
- return Index; // Exit, we found a match\r
- }\r
- }\r
- // If the for loop exits, Token was not found.\r
- return -1; // Indicate failure\r
-}\r
+++ /dev/null
-/** @file\r
- Definitions of ASCII string literals used by DP.\r
-\r
- Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include <PerformanceTokens.h>\r
-\r
-// ASCII String literals which probably don't need translation\r
-CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";\r
-CHAR8 const ALit_SEC[] = SEC_TOK;\r
-CHAR8 const ALit_DXE[] = DXE_TOK;\r
-CHAR8 const ALit_PEI[] = PEI_TOK;\r
-CHAR8 const ALit_BDS[] = BDS_TOK;\r
-CHAR8 const ALit_BdsTO[] = "BdsTimeOut";\r
-CHAR8 const ALit_PEIM[] = "PEIM";\r
+++ /dev/null
-/** @file\r
- Declarations of ASCII string literals used by DP.\r
-\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#ifndef _LITERALS_H_\r
-#define _LITERALS_H_\r
-\r
-// ASCII String literals which probably don't need translation\r
-extern CHAR8 const ALit_TimerLibError[];\r
-extern CHAR8 const ALit_SEC[];\r
-extern CHAR8 const ALit_DXE[];\r
-extern CHAR8 const ALit_SHELL[];\r
-extern CHAR8 const ALit_PEI[];\r
-extern CHAR8 const ALit_BDS[];\r
-extern CHAR8 const ALit_BdsTO[];\r
-extern CHAR8 const ALit_PEIM[];\r
-\r
-#endif // _LITERALS_H_\r
+++ /dev/null
-/** @file\r
- GUID for PerformancePkg PCD Token Space \r
-\r
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _PERFORMANCEPKG_TOKEN_SPACE_GUID_H_\r
-#define _PERFORMANCEPKG_TOKEN_SPACE_GUID_H_\r
-\r
-#define PERFORMANCEPKG_TOKEN_SPACE_GUID \\r
- { \\r
- 0x669346ef, 0xFDad, 0x4aeb, { 0x08, 0xa6, 0x21, 0x46, 0x2d, 0x3f, 0xef, 0x7d } \\r
- }\r
-\r
-extern EFI_GUID gPerformancePkgTokenSpaceGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- GUID for TSC frequency\r
-\r
- Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _TSC_FREQUENCY_GUID_H_\r
-#define _TSC_FREQUENCY_GUID_H_\r
-\r
-#define EFI_TSC_FREQUENCY_GUID \\r
- { \\r
- 0xdba6a7e3, 0xbb57, 0x4be7, { 0x8a, 0xf8, 0xd5, 0x78, 0xdb, 0x7e, 0x56, 0x87 } \\r
- }\r
-\r
-extern EFI_GUID gEfiTscFrequencyGuid;\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- Generic definitions for registers in the Intel Ich devices.\r
-\r
- These definitions should work for any version of Ich.\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _GENERIC_ICH_H_\r
-#define _GENERIC_ICH_H_\r
-\r
-/** GenericIchDefs Generic ICH Definitions.\r
-\r
-Definitions beginning with "R_" are registers.\r
-Definitions beginning with "B_" are bits within registers.\r
-Definitions beginning with "V_" are meaningful values of bits within the registers.\r
-**/\r
-///@{\r
-\r
-/// IchPciAddressing PCI Bus Address for ICH.\r
-///@{\r
-#define PCI_BUS_NUMBER_ICH 0x00 ///< ICH is on PCI Bus 0.\r
-#define PCI_DEVICE_NUMBER_ICH_LPC 31 ///< ICH is Device 31.\r
-#define PCI_FUNCTION_NUMBER_ICH_LPC 0 ///< ICH is Function 0.\r
-///@}\r
-\r
-/// IchAcpiCntr Control for the ICH's ACPI Counter.\r
-///@{\r
-#define R_ICH_LPC_ACPI_BASE 0x40\r
-#define B_ICH_LPC_ACPI_BASE_BAR 0x0000FF80\r
-#define R_ICH_LPC_ACPI_CNT 0x44\r
-#define B_ICH_LPC_ACPI_CNT_ACPI_EN 0x80\r
-///@}\r
-\r
-/// IchAcpiTimer The ICH's ACPI Timer.\r
-///@{\r
-#define R_ACPI_PM1_TMR 0x08\r
-#define V_ACPI_TMR_FREQUENCY 3579545\r
-#define V_ACPI_PM1_TMR_MAX_VAL 0x1000000 ///< The timer is 24 bit overflow.\r
-///@}\r
-\r
-/// Macro to generate the PCI address of any given ICH Register.\r
-#define PCI_ICH_LPC_ADDRESS(Register) \\r
- ((UINTN)(PCI_LIB_ADDRESS (PCI_BUS_NUMBER_ICH, PCI_DEVICE_NUMBER_ICH_LPC, PCI_FUNCTION_NUMBER_ICH_LPC, Register)))\r
-\r
-///@}\r
-#endif // _GENERIC_ICH_H_\r
+++ /dev/null
-/** @file\r
- ASCII String Literals with special meaning to Performance measurement and the Dp utility.\r
-\r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __PERFORMANCE_TOKENS_H__\r
-#define __PERFORMANCE_TOKENS_H__\r
-\r
-#define SEC_TOK "SEC" ///< SEC Phase\r
-#define DXE_TOK "DXE" ///< DEC Phase\r
-#define SHELL_TOK "SHELL" ///< Shell Phase\r
-#define PEI_TOK "PEI" ///< PEI Phase\r
-#define BDS_TOK "BDS" ///< BDS Phase\r
-#define DRIVERBINDING_START_TOK "DB:Start:" ///< Driver Binding Start() function call\r
-#define DRIVERBINDING_SUPPORT_TOK "DB:Support:" ///< Driver Binding Support() function call\r
-#define LOAD_IMAGE_TOK "LoadImage:" ///< Load a dispatched module\r
-#define START_IMAGE_TOK "StartImage:" ///< Dispatched Modules Entry Point execution\r
-\r
-#endif // __PERFORMANCE_TOKENS_H__\r
+++ /dev/null
-/** @file\r
- A Base Timer Library implementation which uses the Time Stamp Counter in the processor.\r
-\r
- For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
- for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
- for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
- for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
- for Intel Atom processors (family [06H], display_model [1CH]):\r
- the time-stamp counter increments at a constant rate.\r
- That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
- the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
- differ from the maximum qualified frequency of the processor.\r
-\r
- The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
- duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
- the processor core changes frequency. This is the architectural behavior moving forward.\r
-\r
- A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TscTimerLibInternal.h"\r
-\r
-/** Get TSC frequency.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalGetTscFrequency (\r
- VOID\r
- )\r
-{\r
- return InternalCalculateTscFrequency ();\r
-}\r
-\r
+++ /dev/null
-## @file\r
-# Base Timer Library which uses the Time Stamp Counter in the processor.\r
-#\r
-# Note: There will be 1ms penalty to get TSC frequency every time\r
-# by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
-#\r
-# Note: This library is a sample implementation that depends on chipset ACPI timer. \r
-# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is \r
-# the generic timer library that can replace this one. \r
-#\r
-# A version of the Timer Library using the processor's TSC.\r
-# The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
-# The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
-# This is the architectural behavior moving forward.\r
-# TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
-# access to a platform resource.\r
-#\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BaseTscTimerLib\r
- FILE_GUID = D29338B9-50FE-4e4f-B7D4-A150A2C1F4FB\r
- MODULE_TYPE = BASE\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = TimerLib\r
-\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64\r
-#\r
-\r
-[Sources.common]\r
- TscTimerLibShare.c\r
- BaseTscTimerLib.c\r
- TscTimerLibInternal.h\r
-\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- PerformancePkg/PerformancePkg.dec\r
-\r
-\r
-[LibraryClasses]\r
- PcdLib\r
- PciLib\r
- IoLib\r
- BaseLib\r
-\r
-[Pcd.common]\r
- gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress ## SOMETIMES_CONSUMES\r
+++ /dev/null
-/** @file\r
- A Dxe Timer Library implementation which uses the Time Stamp Counter in the processor.\r
-\r
- For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
- for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
- for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
- for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
- for Intel Atom processors (family [06H], display_model [1CH]):\r
- the time-stamp counter increments at a constant rate.\r
- That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
- the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
- differ from the maximum qualified frequency of the processor.\r
-\r
- The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
- duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
- the processor core changes frequency. This is the architectural behavior moving forward.\r
-\r
- A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Guid/TscFrequency.h>\r
-#include "TscTimerLibInternal.h"\r
-\r
-UINT64 mTscFrequency;\r
-\r
-/** The constructor function determines the actual TSC frequency.\r
-\r
- First, Get TSC frequency from system configuration table with TSC frequency GUID,\r
- if the table is not found, install it.\r
- This function will always return EFI_SUCCESS.\r
-\r
- @param ImageHandle The firmware allocated handle for the EFI image.\r
- @param SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DxeTscTimerLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINT64 *TscFrequency;\r
-\r
- TscFrequency = NULL;\r
- //\r
- // Get TSC frequency from system configuration table with TSC frequency GUID.\r
- //\r
- Status = EfiGetSystemConfigurationTable (&gEfiTscFrequencyGuid, (VOID **) &TscFrequency);\r
- if (Status == EFI_SUCCESS) {\r
- ASSERT (TscFrequency != NULL);\r
- mTscFrequency = *TscFrequency;\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // TSC frequency GUID system configuration table is not found, install it.\r
- //\r
-\r
- Status = gBS->AllocatePool (EfiBootServicesData, sizeof (UINT64), (VOID **) &TscFrequency);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- *TscFrequency = InternalCalculateTscFrequency ();\r
- //\r
- // TscFrequency now points to the number of TSC counts per second, install system configuration table for it.\r
- //\r
- gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, TscFrequency);\r
-\r
- mTscFrequency = *TscFrequency;\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/** Get TSC frequency.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalGetTscFrequency (\r
- VOID\r
- )\r
-{\r
- return mTscFrequency;\r
-}\r
-\r
+++ /dev/null
-## @file\r
-# Dxe Timer Library which uses the Time Stamp Counter in the processor.\r
-#\r
-# Note: This library is a sample implementation that depends on chipset ACPI timer. \r
-# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is \r
-# the generic timer library that can replace this one. \r
-#\r
-# A version of the Timer Library using the processor's TSC.\r
-# The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
-# The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
-# This is the architectural behavior moving forward.\r
-# TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
-# access to a platform resource.\r
-#\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = DxeTscTimerLib\r
- FILE_GUID = 95ab030f-b4fd-4ee4-92a5-9e04e87634d9\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = TimerLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE\r
-\r
- CONSTRUCTOR = DxeTscTimerLibConstructor\r
-\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64\r
-#\r
-\r
-[Sources.common]\r
- TscTimerLibShare.c\r
- DxeTscTimerLib.c\r
- TscTimerLibInternal.h\r
-\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- PerformancePkg/PerformancePkg.dec\r
-\r
-\r
-[LibraryClasses]\r
- UefiBootServicesTableLib\r
- PcdLib\r
- PciLib\r
- IoLib\r
- BaseLib\r
- UefiLib\r
- DebugLib\r
-\r
-[Guids]\r
- gEfiTscFrequencyGuid ## CONSUMES ## SystemTable\r
-\r
-[Pcd.common]\r
- gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress ## SOMETIMES_CONSUMES\r
+++ /dev/null
-/** @file\r
- A Pei Timer Library implementation which uses the Time Stamp Counter in the processor.\r
-\r
- For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
- for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
- for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
- for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
- for Intel Atom processors (family [06H], display_model [1CH]):\r
- the time-stamp counter increments at a constant rate.\r
- That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
- the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
- differ from the maximum qualified frequency of the processor.\r
-\r
- The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
- duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
- the processor core changes frequency. This is the architectural behavior moving forward.\r
-\r
- A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <PiPei.h>\r
-#include <Library/HobLib.h>\r
-#include <Guid/TscFrequency.h>\r
-#include "TscTimerLibInternal.h"\r
-\r
-/** Get TSC frequency from TSC frequency GUID HOB, if the HOB is not found, build it.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalGetTscFrequency (\r
- VOID\r
- )\r
-{\r
- EFI_HOB_GUID_TYPE *GuidHob;\r
- VOID *DataInHob;\r
- UINT64 TscFrequency;\r
-\r
- //\r
- // Get TSC frequency from TSC frequency GUID HOB.\r
- //\r
- GuidHob = GetFirstGuidHob (&gEfiTscFrequencyGuid);\r
- if (GuidHob != NULL) {\r
- DataInHob = GET_GUID_HOB_DATA (GuidHob);\r
- TscFrequency = * (UINT64 *) DataInHob;\r
- return TscFrequency;\r
- }\r
-\r
- //\r
- // TSC frequency GUID HOB is not found, build it.\r
- //\r
-\r
- TscFrequency = InternalCalculateTscFrequency ();\r
- //\r
- // TscFrequency is now equal to the number of TSC counts per second, build GUID HOB for it.\r
- //\r
- BuildGuidDataHob (\r
- &gEfiTscFrequencyGuid,\r
- &TscFrequency,\r
- sizeof (UINT64)\r
- );\r
-\r
- return TscFrequency;\r
-}\r
-\r
+++ /dev/null
-## @file\r
-# Pei Timer Library which uses the Time Stamp Counter in the processor.\r
-#\r
-# Note: This library is a sample implementation that depends on chipset ACPI timer. \r
-# It may not work on new generation chipset. PcAtChipsetPkg AcpiTimerLib is \r
-# the generic timer library that can replace this one. \r
-#\r
-# A version of the Timer Library using the processor's TSC.\r
-# The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
-# The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
-# This is the architectural behavior moving forward.\r
-# TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
-# access to a platform resource.\r
-#\r
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = PeiTscTimerLib\r
- FILE_GUID = 342C36C0-15DF-43b4-9EC9-FBF748BFB3D1\r
- MODULE_TYPE = PEIM\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = TimerLib|PEIM PEI_CORE\r
-\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64\r
-#\r
-\r
-[Sources.common]\r
- TscTimerLibShare.c\r
- PeiTscTimerLib.c\r
- TscTimerLibInternal.h\r
-\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- PerformancePkg/PerformancePkg.dec\r
-\r
-\r
-[LibraryClasses]\r
- PcdLib\r
- PciLib\r
- IoLib\r
- BaseLib\r
- HobLib\r
-\r
-[Guids]\r
- gEfiTscFrequencyGuid ## PRODUCES ## HOB\r
-\r
-[Pcd.common]\r
- gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress ## SOMETIMES_CONSUMES\r
+++ /dev/null
-/** @file\r
- Internal header file for TscTimerLib instances.\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _TSC_TIMER_LIB_INTERNAL_H_\r
-#define _TSC_TIMER_LIB_INTERNAL_H_\r
-\r
-#include <Ich/GenericIch.h>\r
-\r
-#include <Library/TimerLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/PciLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-/** Get TSC frequency.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalGetTscFrequency (\r
- VOID\r
- );\r
-\r
-/** Calculate TSC frequency.\r
-\r
- The TSC counting frequency is determined by comparing how far it counts\r
- during a 1ms period as determined by the ACPI timer. The ACPI timer is\r
- used because it counts at a known frequency.\r
- If ACPI I/O space not enabled, this function will enable it. Then the\r
- TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
- The TSC is then sampled again. The difference multiplied by 1000 is the TSC\r
- frequency. There will be a small error because of the overhead of reading\r
- the ACPI timer. An attempt is made to determine and compensate for this error.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalCalculateTscFrequency (\r
- VOID\r
- );\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- The Timer Library implementation which uses the Time Stamp Counter in the processor.\r
-\r
- For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
- for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
- for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
- for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
- for Intel Atom processors (family [06H], display_model [1CH]):\r
- the time-stamp counter increments at a constant rate.\r
- That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
- the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
- differ from the maximum qualified frequency of the processor.\r
-\r
- The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
- duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
- the processor core changes frequency. This is the architectural behavior moving forward.\r
-\r
- A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
-\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TscTimerLibInternal.h"\r
-\r
-/** Calculate TSC frequency.\r
-\r
- The TSC counting frequency is determined by comparing how far it counts\r
- during a 1ms period as determined by the ACPI timer. The ACPI timer is\r
- used because it counts at a known frequency.\r
- If ACPI I/O space not enabled, this function will enable it. Then the\r
- TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
- The TSC is then sampled again. The difference multiplied by 1000 is the TSC\r
- frequency. There will be a small error because of the overhead of reading\r
- the ACPI timer. An attempt is made to determine and compensate for this error.\r
-\r
- @return The number of TSC counts per second.\r
-\r
-**/\r
-UINT64\r
-InternalCalculateTscFrequency (\r
- VOID\r
- )\r
-{\r
- UINT64 StartTSC;\r
- UINT64 EndTSC;\r
- UINT32 TimerAddr;\r
- UINT32 Ticks;\r
- UINT64 TscFrequency;\r
-\r
- //\r
- // If ACPI I/O space is not enabled yet, program ACPI I/O base address and enable it.\r
- //\r
- if ((PciRead8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT)) & B_ICH_LPC_ACPI_CNT_ACPI_EN) == 0) {\r
- PciWrite16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE), PcdGet16 (PcdPerfPkgAcpiIoPortBaseAddress));\r
- PciOr8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT), B_ICH_LPC_ACPI_CNT_ACPI_EN);\r
- }\r
-\r
- //\r
- // ACPI I/O space should be enabled now, locate the ACPI Timer.\r
- // ACPI I/O base address maybe have be initialized by other driver with different value,\r
- // So get it from PCI space directly.\r
- //\r
- TimerAddr = ((PciRead16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE))) & B_ICH_LPC_ACPI_BASE_BAR) + R_ACPI_PM1_TMR;\r
- Ticks = IoRead32 (TimerAddr) + (3579); // Set Ticks to 1ms in the future\r
- StartTSC = AsmReadTsc(); // Get base value for the TSC\r
- //\r
- // Wait until the ACPI timer has counted 1ms.\r
- // Timer wrap-arounds are handled correctly by this function.\r
- // When the current ACPI timer value is greater than 'Ticks', the while loop will exit.\r
- //\r
- while (((Ticks - IoRead32 (TimerAddr)) & BIT23) == 0) {\r
- CpuPause();\r
- }\r
- EndTSC = AsmReadTsc(); // TSC value 1ms later\r
-\r
- TscFrequency = MultU64x32 (\r
- (EndTSC - StartTSC), // Number of TSC counts in 1ms\r
- 1000 // Number of ms in a second\r
- );\r
-\r
- return TscFrequency;\r
-}\r
-\r
-/** Stalls the CPU for at least the given number of ticks.\r
-\r
- Stalls the CPU for at least the given number of ticks. It's invoked by\r
- MicroSecondDelay() and NanoSecondDelay().\r
-\r
- @param[in] Delay A period of time to delay in ticks.\r
-\r
-**/\r
-VOID\r
-InternalX86Delay (\r
- IN UINT64 Delay\r
- )\r
-{\r
- UINT64 Ticks;\r
-\r
- //\r
- // The target timer count is calculated here\r
- //\r
- Ticks = AsmReadTsc() + Delay;\r
-\r
- //\r
- // Wait until time out\r
- // Timer wrap-arounds are NOT handled correctly by this function.\r
- // Thus, this function must be called within 10 years of reset since\r
- // Intel guarantees a minimum of 10 years before the TSC wraps.\r
- //\r
- while (AsmReadTsc() <= Ticks) CpuPause();\r
-}\r
-\r
-/** Stalls the CPU for at least the specified number of MicroSeconds.\r
-\r
- @param[in] MicroSeconds The minimum number of microseconds to delay.\r
-\r
- @return The value of MicroSeconds input.\r
-\r
-**/\r
-UINTN\r
-EFIAPI\r
-MicroSecondDelay (\r
- IN UINTN MicroSeconds\r
- )\r
-{\r
- InternalX86Delay (\r
- DivU64x32 (\r
- MultU64x64 (\r
- InternalGetTscFrequency (),\r
- MicroSeconds\r
- ),\r
- 1000000u\r
- )\r
- );\r
- return MicroSeconds;\r
-}\r
-\r
-/** Stalls the CPU for at least the specified number of NanoSeconds.\r
-\r
- @param[in] NanoSeconds The minimum number of nanoseconds to delay.\r
-\r
- @return The value of NanoSeconds input.\r
-\r
-**/\r
-UINTN\r
-EFIAPI\r
-NanoSecondDelay (\r
- IN UINTN NanoSeconds\r
- )\r
-{\r
- InternalX86Delay (\r
- DivU64x32 (\r
- MultU64x32 (\r
- InternalGetTscFrequency (),\r
- (UINT32)NanoSeconds\r
- ),\r
- 1000000000u\r
- )\r
- );\r
- return NanoSeconds;\r
-}\r
-\r
-/** Retrieves the current value of the 64-bit free running Time-Stamp counter.\r
-\r
- The time-stamp counter (as implemented in the P6 family, Pentium, Pentium M,\r
- Pentium 4, Intel Xeon, Intel Core Solo and Intel Core Duo processors and\r
- later processors) is a 64-bit counter that is set to 0 following a RESET of\r
- the processor. Following a RESET, the counter increments even when the\r
- processor is halted by the HLT instruction or the external STPCLK# pin. Note\r
- that the assertion of the external DPSLP# pin may cause the time-stamp\r
- counter to stop.\r
-\r
- The properties of the counter can be retrieved by the\r
- GetPerformanceCounterProperties() function.\r
-\r
- @return The current value of the free running performance counter.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-GetPerformanceCounter (\r
- VOID\r
- )\r
-{\r
- return AsmReadTsc();\r
-}\r
-\r
-/** Retrieves the 64-bit frequency in Hz and the range of performance counter\r
- values.\r
-\r
- If StartValue is not NULL, then the value that the performance counter starts\r
- with, 0x0, is returned in StartValue. If EndValue is not NULL, then the value\r
- that the performance counter end with, 0xFFFFFFFFFFFFFFFF, is returned in\r
- EndValue.\r
-\r
- The 64-bit frequency of the performance counter, in Hz, is always returned.\r
- To determine average processor clock frequency, Intel recommends the use of\r
- EMON logic to count processor core clocks over the period of time for which\r
- the average is required.\r
-\r
-\r
- @param[out] StartValue Pointer to where the performance counter's starting value is saved, or NULL.\r
- @param[out] EndValue Pointer to where the performance counter's ending value is saved, or NULL.\r
-\r
- @return The frequency in Hz.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-GetPerformanceCounterProperties (\r
- OUT UINT64 *StartValue, OPTIONAL\r
- OUT UINT64 *EndValue OPTIONAL\r
- )\r
-{\r
- if (StartValue != NULL) {\r
- *StartValue = 0;\r
- }\r
- if (EndValue != NULL) {\r
- *EndValue = 0xFFFFFFFFFFFFFFFFull;\r
- }\r
-\r
- return InternalGetTscFrequency ();\r
-}\r
-\r
-/**\r
- Converts elapsed ticks of performance counter to time in nanoseconds.\r
-\r
- This function converts the elapsed ticks of running performance counter to\r
- time value in unit of nanoseconds.\r
-\r
- @param Ticks The number of elapsed ticks of running performance counter.\r
-\r
- @return The elapsed time in nanoseconds.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-GetTimeInNanoSecond (\r
- IN UINT64 Ticks\r
- )\r
-{\r
- UINT64 Frequency;\r
- UINT64 NanoSeconds;\r
- UINT64 Remainder;\r
- INTN Shift;\r
-\r
- Frequency = GetPerformanceCounterProperties (NULL, NULL);\r
-\r
- //\r
- // Ticks\r
- // Time = --------- x 1,000,000,000\r
- // Frequency\r
- //\r
- NanoSeconds = MultU64x32 (DivU64x64Remainder (Ticks, Frequency, &Remainder), 1000000000u);\r
-\r
- //\r
- // Ensure (Remainder * 1,000,000,000) will not overflow 64-bit.\r
- // Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,\r
- // i.e. highest bit set in Remainder should <= 33.\r
- //\r
- Shift = MAX (0, HighBitSet64 (Remainder) - 33);\r
- Remainder = RShiftU64 (Remainder, (UINTN) Shift);\r
- Frequency = RShiftU64 (Frequency, (UINTN) Shift);\r
- NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);\r
-\r
- return NanoSeconds;\r
-}\r
+++ /dev/null
-## @file\r
-# Build description file to generate Shell DP application and\r
-# Performance Libraries.\r
-#\r
-# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- PACKAGE_NAME = PerformancePkg\r
- PACKAGE_GUID = ce898697-b945-46e2-a26e-5752af565185\r
- PACKAGE_VERSION = 0.2\r
- DEC_SPECIFICATION = 0x00010005\r
-\r
-[Includes]\r
- Include\r
-\r
-[Guids]\r
- ## Performance Package token space guid\r
- # Include/Guid/PerformancePkgTokenSpace.h\r
- # 669346ef-fdad-4aeb-a608-7def3f2d4621\r
- gPerformancePkgTokenSpaceGuid = { 0x669346ef, 0xFDad, 0x4aeb, { 0x08, 0xa6, 0x21, 0x46, 0x2d, 0x3f, 0xef, 0x7d }}\r
-\r
- ## Include/Guid/TscFrequency.h\r
- gEfiTscFrequencyGuid = { 0xdba6a7e3, 0xbb57, 0x4be7, { 0x8a, 0xf8, 0xd5, 0x78, 0xdb, 0x7e, 0x56, 0x87 }}\r
-\r
-[PcdsFixedAtBuild]\r
- ## The base address of the ACPI registers within the ICH PCI space.\r
- # This space must be 128-byte aligned.\r
- gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress|0x400|UINT16|1\r
+++ /dev/null
-## @file\r
-# Build description file to generate Shell DP application.\r
-#\r
-# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
-# 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
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- DSC_SPECIFICATION = 0x00010005\r
- PLATFORM_NAME = PerformancePkg\r
- PLATFORM_GUID = 9ffd7bf2-231e-4525-9a42-480545dafd17\r
- PLATFORM_VERSION = 0.2\r
- OUTPUT_DIRECTORY = Build/PerformancePkg\r
- SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC\r
- BUILD_TARGETS = DEBUG|RELEASE|NOOPT\r
- SKUID_IDENTIFIER = DEFAULT\r
-\r
-[LibraryClasses]\r
- #\r
- # Entry Point Libraries\r
- #\r
- UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf\r
- #\r
- # Common Libraries\r
- #\r
- BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
- BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf\r
- UefiLib|MdePkg/Library/UefiLib/UefiLib.inf\r
- PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
- PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
- HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
- MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
- UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
- UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
- DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf\r
- DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf \r
- DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf\r
- PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
- HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
- UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf\r
- PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf\r
- IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
- FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf\r
- SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
-\r
- ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf\r
-\r
- PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf\r
- PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf\r
- DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
-\r
-[Components.IA32, Components.X64]\r
- PerformancePkg/Library/TscTimerLib/DxeTscTimerLib.inf\r
- PerformancePkg/Library/TscTimerLib/PeiTscTimerLib.inf\r
- PerformancePkg/Library/TscTimerLib/BaseTscTimerLib.inf\r
-\r
-[Components]\r
- PerformancePkg/Dp_App/Dp.inf\r
-\r
-[BuildOptions]\r
- *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES\r