From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E6EC2119C8B4 for ; Mon, 11 Jun 2018 01:32:38 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 01:32:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,501,1520924400"; d="scan'208";a="48906339" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga006.jf.intel.com with ESMTP; 11 Jun 2018 01:32:36 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Ruiyu Ni , Jaben Carsey Date: Mon, 11 Jun 2018 16:32:06 +0800 Message-Id: <20180611083206.106804-3-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 In-Reply-To: <20180611083206.106804-1-dandan.bi@intel.com> References: <20180611083206.106804-1-dandan.bi@intel.com> Subject: [patch V2 3/3] ShellPkg/Dp: Make the help info align with code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 08:32:38 -0000 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 --- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 96 ++++++-------------- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h | 7 -- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni | 6 +- ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf | 1 - .../DpDynamicCommand/DpDynamicCommand.inf | 1 - .../DynamicCommand/DpDynamicCommand/DpInternal.h | 48 ---------- .../DynamicCommand/DpDynamicCommand/DpProfile.c | 100 --------------------- 7 files changed, 26 insertions(+), 233 deletions(-) delete mode 100644 ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index d8451dbf59f..38766613175 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -82,14 +82,10 @@ UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA); STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"-v", TypeFlag}, // -v Verbose Mode {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. {L"-n", TypeValue}, // -n # Number of records to display for A and R {L"-t", TypeValue}, // -t # Threshold of interest @@ -114,13 +110,10 @@ DumpStatistics( void ) ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), mDpHiiHandle, SummaryData.NumIncomplete); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPHASES), mDpHiiHandle, SummaryData.NumSummary); 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); } /** @@ -682,11 +675,10 @@ VOID InitSummaryData ( VOID ) { SummaryData.NumTrace = 0; - SummaryData.NumProfile = 0 ; SummaryData.NumIncomplete = 0; SummaryData.NumSummary = 0; SummaryData.NumHandles = 0; SummaryData.NumPEIMs = 0; SummaryData.NumGlobal = 0; @@ -719,12 +711,10 @@ RunDp ( EFI_STRING StringPtr; BOOLEAN SummaryMode; BOOLEAN VerboseMode; BOOLEAN AllMode; BOOLEAN RawMode; - BOOLEAN TraceMode; - BOOLEAN ProfileMode; BOOLEAN ExcludeMode; BOOLEAN CumulativeMode; CONST CHAR16 *CustomCumulativeToken; PERF_CUM_DATA *CustomCumulativeData; UINTN NameSize; @@ -734,12 +724,10 @@ RunDp ( StringPtr = NULL; SummaryMode = FALSE; VerboseMode = FALSE; AllMode = FALSE; RawMode = FALSE; - TraceMode = FALSE; - ProfileMode = FALSE; ExcludeMode = FALSE; CumulativeMode = FALSE; CustomCumulativeData = NULL; ShellStatus = SHELL_SUCCESS; @@ -763,14 +751,10 @@ RunDp ( // VerboseMode = ShellCommandLineGetFlag (ParamPackage, L"-v"); 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"); // Options with Values @@ -789,18 +773,10 @@ RunDp ( mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us } else { 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. // Folloing 3 steps are to get the measurement form the FPDT table. // @@ -917,71 +893,49 @@ RunDp ( **** n Number2Display Used by All and Raw mode. Otherwise ignored. **** A All -- R and S options are ignored **** 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) { DumpStatistics(); } diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h index 9fd88578720..aae021334d6 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h @@ -51,16 +51,10 @@ extern EFI_HANDLE mDpHiiHandle; * The value assigned to DP_DEBUG controls which debug output * is generated. Set it to ZERO to disable. **/ #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. #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL @@ -95,11 +89,10 @@ typedef struct { UINT32 Count; ///< Total number of measurements accumulated. } PERF_CUM_DATA; 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. UINT32 NumPEIMs; ///< Number of measurements of PEIMs. UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle. diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni index c7eb0fbd71e..ced8a487428 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni @@ -70,19 +70,17 @@ #string STR_DP_STATS_NUMPHASES #language en-US "%,8d are major execution phases.\n" #string STR_DP_STATS_NUMHANDLES #language en-US "%,8d have non-NULL handles, %d are NULL.\n" #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" #string STR_DP_ALL_DASHES2 #language en-US "-------------------------------------------------------------------------------------\n" #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" #string STR_DP_RAW_DASHES2 #language en-US "---------------------------------------------------------------------------------------------------------------------------------\n" #string STR_DP_RAW_VARS2 #language en-US "%5d: %16LX %16LX %16LX %31a %31a %5d\n" @@ -96,21 +94,19 @@ #string STR_GET_HELP_DP #language en-US "" ".TH dp 0 "Display performance metrics"\r\n" ".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" " -v - Displays additional information\r\n" " -x - Prevents display of individual measurements for cumulative items\r\n" " -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" " -c TOKEN - Display pre-defined and custom cumulative data\r\n" " Pre-defined cumulative token are:\r\n" diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf index 54fe0017541..cedb333b285 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf @@ -31,11 +31,10 @@ Literals.h Literals.c DpInternal.h DpUtilities.c DpTrace.c - DpProfile.c DpApp.c [Packages] MdePkg/MdePkg.dec ShellPkg/ShellPkg.dec diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf index e906870bd5e..8fd3bbd5df8 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf @@ -32,11 +32,10 @@ Literals.h Literals.c DpInternal.h DpUtilities.c DpTrace.c - DpProfile.c DpDynamicCommand.c [Packages] MdePkg/MdePkg.dec ShellPkg/ShellPkg.dec diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h index eedc377cded..8dd3076cc71 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h @@ -302,54 +302,6 @@ ProcessGlobal( VOID 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 af25217daef..00000000000 --- 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); -} -- 2.14.3.windows.1