From: Dandan Bi Date: Sat, 12 May 2018 13:00:23 +0000 (+0800) Subject: ShellPkg/Dp: Make the help info align with code X-Git-Tag: edk2-stable201903~1603 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=5a56c0493955cf55e7eef96dbba815cfbb067d7d ShellPkg/Dp: Make the help info align with code Currently in DP, the Trace mode is enabled by default. And the profile mode is not implemented. but the help info of DP tool doesn't match current implementation. Which will make user confused. So now remove the unused source code related to the profile mode and update the help information of DP tool. V2: Remove the unused code related to profile mode. Cc: Liming Gao Cc: Ruiyu Ni Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Liming Gao --- diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index d8451dbf59..3876661317 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -84,10 +84,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"-A", TypeFlag}, // -A All, Cooked {L"-R", TypeFlag}, // -R RAW All {L"-s", TypeFlag}, // -s Summary -#if PROFILING_IMPLEMENTED - {L"-P", TypeFlag}, // -P Dump Profile Data - {L"-T", TypeFlag}, // -T Dump Trace Data -#endif // PROFILING_IMPLEMENTED {L"-x", TypeFlag}, // -x eXclude Cumulative Items {L"-i", TypeFlag}, // -i Display Identifier {L"-c", TypeValue}, // -c Display cumulative data. @@ -116,9 +112,6 @@ DumpStatistics( void ) ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), mDpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDpHiiHandle, SummaryData.NumPEIMs); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle, SummaryData.NumGlobal); -#if PROFILING_IMPLEMENTED - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPROFILE), mDpHiiHandle, SummaryData.NumProfile); -#endif // PROFILING_IMPLEMENTED SHELL_FREE_NON_NULL (StringPtr); SHELL_FREE_NON_NULL (StringPtrUnknown); } @@ -684,7 +677,6 @@ InitSummaryData ( ) { SummaryData.NumTrace = 0; - SummaryData.NumProfile = 0 ; SummaryData.NumIncomplete = 0; SummaryData.NumSummary = 0; SummaryData.NumHandles = 0; @@ -721,8 +713,6 @@ RunDp ( BOOLEAN VerboseMode; BOOLEAN AllMode; BOOLEAN RawMode; - BOOLEAN TraceMode; - BOOLEAN ProfileMode; BOOLEAN ExcludeMode; BOOLEAN CumulativeMode; CONST CHAR16 *CustomCumulativeToken; @@ -736,8 +726,6 @@ RunDp ( VerboseMode = FALSE; AllMode = FALSE; RawMode = FALSE; - TraceMode = FALSE; - ProfileMode = FALSE; ExcludeMode = FALSE; CumulativeMode = FALSE; CustomCumulativeData = NULL; @@ -765,10 +753,6 @@ RunDp ( SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, L"-S") || ShellCommandLineGetFlag (ParamPackage, L"-s")); AllMode = ShellCommandLineGetFlag (ParamPackage, L"-A"); RawMode = ShellCommandLineGetFlag (ParamPackage, L"-R"); -#if PROFILING_IMPLEMENTED - TraceMode = ShellCommandLineGetFlag (ParamPackage, L"-T"); - ProfileMode = ShellCommandLineGetFlag (ParamPackage, L"-P"); -#endif // PROFILING_IMPLEMENTED ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); @@ -791,14 +775,6 @@ RunDp ( mInterestThreshold = StrDecimalToUint64(CmdLineArg); } - // Handle Flag combinations and default behaviors - // If both TraceMode and ProfileMode are FALSE, set them both to TRUE - if ((! TraceMode) && (! ProfileMode)) { - TraceMode = TRUE; -#if PROFILING_IMPLEMENTED - ProfileMode = TRUE; -#endif // PROFILING_IMPLEMENTED - } // // DP dump performance data by parsing FPDT table in ACPI table. @@ -919,67 +895,45 @@ RunDp ( **** R Raw -- S option is ignored **** s Summary -- Modifies "Cooked" output only **** Cooked (Default) -**** -**** The All, Raw, and Cooked modes are modified by the Trace and Profile -**** options. -**** !T && !P := (0) Default, Both are displayed -**** T && !P := (1) Only Trace records are displayed -**** !T && P := (2) Only Profile records are displayed -**** T && P := (3) Same as Default, both are displayed ****************************************************************************/ GatherStatistics (CustomCumulativeData); if (CumulativeMode) { ProcessCumulative (CustomCumulativeData); } else if (AllMode) { - if (TraceMode) { - Status = DumpAllTrace( Number2Display, ExcludeMode); + Status = DumpAllTrace( Number2Display, ExcludeMode); + if (Status == EFI_ABORTED) { + ShellStatus = SHELL_ABORTED; + goto Done; + } + } else if (RawMode) { + Status = DumpRawTrace( Number2Display, ExcludeMode); + if (Status == EFI_ABORTED) { + ShellStatus = SHELL_ABORTED; + goto Done; + } + } else { + //------------- Begin Cooked Mode Processing + ProcessPhases (); + if ( ! SummaryMode) { + Status = ProcessHandles ( ExcludeMode); if (Status == EFI_ABORTED) { ShellStatus = SHELL_ABORTED; goto Done; } - } - if (ProfileMode) { - DumpAllProfile( Number2Display, ExcludeMode); - } - } else if (RawMode) { - if (TraceMode) { - Status = DumpRawTrace( Number2Display, ExcludeMode); + + Status = ProcessPeims (); if (Status == EFI_ABORTED) { ShellStatus = SHELL_ABORTED; goto Done; } - } - if (ProfileMode) { - DumpRawProfile( Number2Display, ExcludeMode); - } - } else { - //------------- Begin Cooked Mode Processing - if (TraceMode) { - ProcessPhases (); - if ( ! SummaryMode) { - Status = ProcessHandles ( ExcludeMode); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - Status = ProcessPeims (); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - Status = ProcessGlobal (); - if (Status == EFI_ABORTED) { - ShellStatus = SHELL_ABORTED; - goto Done; - } - - ProcessCumulative (NULL); + + Status = ProcessGlobal (); + if (Status == EFI_ABORTED) { + ShellStatus = SHELL_ABORTED; + goto Done; } - } - if (ProfileMode) { - DumpAllProfile( Number2Display, ExcludeMode); + + ProcessCumulative (NULL); } } //------------- End of Cooked Mode Processing if ( VerboseMode || SummaryMode) { diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h index 9fd8857872..aae021334d 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h @@ -53,12 +53,6 @@ extern EFI_HANDLE mDpHiiHandle; **/ #define DP_DEBUG 0 -/** - * Set to 1 once Profiling has been implemented in order to enable - * profiling related options and report output. -**/ -#define PROFILING_IMPLEMENTED 0 - #define DEFAULT_THRESHOLD 1000 ///< One millisecond. #define DEFAULT_DISPLAYCOUNT 50 #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number. @@ -97,7 +91,6 @@ typedef struct { typedef struct { UINT32 NumTrace; ///< Number of recorded TRACE performance measurements. - UINT32 NumProfile; ///< Number of recorded PROFILE performance measurements. UINT32 NumIncomplete; ///< Number of measurements with no END value. UINT32 NumSummary; ///< Number of summary section measurements. UINT32 NumHandles; ///< Number of measurements with handles. diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni index c7eb0fbd71..ced8a48742 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni @@ -72,7 +72,6 @@ #string STR_DP_STATS_NUMPEIMS #language en-US "%,8d are PEIMs.\n" #string STR_DP_STATS_NUMGLOBALS #language en-US "%,8d are general measurements.\n" #string STR_DP_STATS_NUMPROFILE #language en-US "%,8d are profiling records.\n" -#string STR_DP_SECTION_PROFILE #language en-US "Sequential Profile Records" #string STR_DP_SECTION_ALL #language en-US "Sequential Trace Records" #string STR_DP_ALL_HEADR #language en-US "\nIndex Handle Module Token Time(us)\n" #string STR_DP_ALL_VARS #language en-US "%5d:%3s0x%08p %36s %13s %L8d\n" @@ -80,7 +79,6 @@ #string STR_DP_ALL_HEADR2 #language en-US "\nIndex Handle Module Token Time(us) ID\n" #string STR_DP_ALL_VARS2 #language en-US "%5d:%3s0x%08p %36s %13s %L8d %5d\n" #string STR_DP_SECTION_RAWTRACE #language en-US "RAW Trace" -#string STR_DP_SECTION_RAWPROFILE #language en-US "RAW Profile" #string STR_DP_RAW_DASHES #language en-US "---------------------------------------------------------------------------------------------------------------------------\n" #string STR_DP_RAW_VARS #language en-US "%5d: %16LX %16LX %16LX %31a %31a\n" #string STR_DP_RAW_HEADR #language en-US "\nIndex Handle Start Count End Count Token Module\n" @@ -98,7 +96,7 @@ ".SH NAME\r\n" "Displays performance metrics that are stored in memory.\r\n" ".SH SYNOPSIS\r\n" -"DP [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]][-i] [-h | -?]\r\n" +"DP [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]][-i] [-?]\r\n" ".SH OPTIONS\r\n" " \r\n" " -b - Displays on multiple pages\r\n" @@ -107,8 +105,6 @@ " -s - Displays summary information only\r\n" " -A - Displays all measurements in a list\r\n" " -R - Displays all measurements in raw format\r\n" -" -T - Displays trace measurements only\r\n" -" -P - Displays profile measurements only\r\n" " -t VALUE - Sets display threshold to VALUE microseconds\r\n" " -n COUNT - Limits display to COUNT lines in All and Raw modes\r\n" " -i - Displays identifier\r\n" diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf index 54fe001754..cedb333b28 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf @@ -33,7 +33,6 @@ DpInternal.h DpUtilities.c DpTrace.c - DpProfile.c DpApp.c [Packages] diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf index e906870bd5..8fd3bbd5df 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf @@ -34,7 +34,6 @@ DpInternal.h DpUtilities.c DpTrace.c - DpProfile.c DpDynamicCommand.c [Packages] diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h index eedc377cde..8dd3076cc7 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h @@ -304,52 +304,4 @@ ProcessCumulative( IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL ); -/** - Gather and print ALL Profiling Records. - - Displays all "interesting" Profile measurements in order. - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - The mGaugeString and mUnicodeToken global arrays are used for temporary string storage. - They must not be in use by a calling function. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - -**/ -VOID -DumpAllProfile( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ); - -/** - Gather and print Raw Profile Records. - - All Profile measurements with a duration greater than or equal to - mInterestThreshold are printed without interpretation. - - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - -**/ -VOID -DumpRawProfile( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ); - #endif diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c b/ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c deleted file mode 100644 index af25217dae..0000000000 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c +++ /dev/null @@ -1,100 +0,0 @@ -/** @file - Measured Profiling reporting for the Dp utility. - - Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "Dp.h" -#include "Literals.h" -#include "DpInternal.h" - -/** - Gather and print ALL Profiling Records. - - Displays all "interesting" Profile measurements in order. - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - The mGaugeString and mUnicodeToken global arrays are used for temporary string storage. - They must not be in use by a calling function. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - -**/ -VOID -DumpAllProfile( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ) -{ - EFI_STRING StringPtr; - EFI_STRING StringPtrUnknown; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL); - - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown: StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); -} - -/** - Gather and print Raw Profile Records. - - All Profile measurements with a duration greater than or equal to - mInterestThreshold are printed without interpretation. - - The number of records displayed is controlled by: - - records with a duration less than mInterestThreshold microseconds are not displayed. - - No more than Limit records are displayed. A Limit of zero will not limit the output. - - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - displayed. - - @pre The mInterestThreshold global variable is set to the shortest duration to be printed. - - @param[in] Limit The number of records to print. Zero is ALL. - @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. - -**/ -VOID -DumpRawProfile( - IN UINTN Limit, - IN BOOLEAN ExcludeFlag - ) -{ - EFI_STRING StringPtr; - EFI_STRING StringPtrUnknown; - - StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); - StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle, - (StringPtr == NULL) ? StringPtrUnknown: StringPtr); - FreePool (StringPtr); - FreePool (StringPtrUnknown); -}