From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 E8E1882098 for ; Fri, 3 Feb 2017 09:36:24 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 03 Feb 2017 09:36:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,329,1477983600"; d="scan'208";a="816738417" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by FMSMGA003.fm.intel.com with ESMTP; 03 Feb 2017 09:36:24 -0800 Received: from orsmsx112.amr.corp.intel.com (10.22.240.13) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 3 Feb 2017 09:36:23 -0800 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.27]) by ORSMSX112.amr.corp.intel.com ([169.254.3.23]) with mapi id 14.03.0248.002; Fri, 3 Feb 2017 09:36:23 -0800 From: "Kinney, Michael D" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: Andrew Fish , "Gao, Liming" , "Carsey, Jaben" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency Thread-Index: AQHSfdnQG8wLA3ZoHEaAhxZNwo6HLKFXSPwAgABC/ZA= Date: Fri, 3 Feb 2017 17:36:22 +0000 Message-ID: References: <1486097737-12816-1-git-send-email-michael.d.kinney@intel.com> <1486097737-12816-4-git-send-email-michael.d.kinney@intel.com> <74D8A39837DF1E4DA445A8C0B3885C503A8E8C1B@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A8E8C1B@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODVjMTc1NzEtMzc5Mi00YTI5LTgyZTEtYzc5ZDZhYWE2NmRkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlhUSTlHTEJ4U2JYTUYwM1Vxa2dEWVdyb3VHUUJXUk11ZnR6a21IZXVacjQ9In0= x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Feb 2017 17:36:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen, If we do this, then we would also need to update all the=20 platform DSC files that build the shell from sources too. Maybe we should consider this in a different patch series? Mike > -----Original Message----- > From: Yao, Jiewen > Sent: Thursday, February 2, 2017 9:35 PM > To: Kinney, Michael D ; edk2-devel@lists.01.o= rg > Cc: Andrew Fish ; Gao, Liming ; Ca= rsey, Jaben > ; Zeng, Star > Subject: RE: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib de= pendency >=20 > I have one more suggestion. > Can we use MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib= .inf as > default one in DSC? >=20 > So that the binary built with default DSC can be used on any platform. >=20 > ShellPkg.dsc: > ShellPkg/Library/UefiDpLib/UefiDpLib.inf { > > - TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullT= emplate.inf >=20 > PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNu= ll.inf > DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > } >=20 >=20 > Thank you > Yao Jiewen >=20 >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Michael Kinney > > Sent: Friday, February 3, 2017 12:56 PM > > To: edk2-devel@lists.01.org > > Cc: Andrew Fish ; Gao, Liming ; = Yao, > > Jiewen ; Carsey, Jaben ; = Zeng, > > Star > > Subject: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib depe= ndency > > > > From: Star Zeng > > > > Current UefiDpLib implementation depends on TimerLib, > > as different platforms may implement and use their > > own TimerLib, it makes the dp command needs to be built > > by platform. The TimerLib dependency can be removed by > > using performance property configuration table to make > > UefiDpLib to be generic. > > > > Cc: Andrew Fish > > Cc: Michael Kinney > > Cc: Liming Gao > > Cc: Jiewen Yao > > Cc: Cinnamon Shia > > Cc: Jaben Carsey > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Star Zeng > > --- > > ShellPkg/Library/UefiDpLib/Dp.c | 29 +++++++++++-------------= ----- > > ShellPkg/Library/UefiDpLib/DpInternal.h | 6 ++---- > > ShellPkg/Library/UefiDpLib/DpProfile.c | 3 +-- > > ShellPkg/Library/UefiDpLib/DpTrace.c | 25 ++----------------------= - > > ShellPkg/Library/UefiDpLib/DpUtilities.c | 3 +-- > > ShellPkg/Library/UefiDpLib/Literals.c | 3 +-- > > ShellPkg/Library/UefiDpLib/UefiDpLib.inf | 6 ++++-- > > ShellPkg/Library/UefiDpLib/UefiDpLib.uni | 3 ++- > > ShellPkg/ShellPkg.dsc | 3 +-- > > 9 files changed, 25 insertions(+), 56 deletions(-) > > > > diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpL= ib/Dp.c > > index 75c7d11..444c136 100644 > > --- a/ShellPkg/Library/UefiDpLib/Dp.c > > +++ b/ShellPkg/Library/UefiDpLib/Dp.c > > @@ -13,7 +13,7 @@ > > Dp uses this information to group records in different ways. It als= o uses > > timer information to calculate elapsed time for each measurement. > > > > - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > > + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > > (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of th= e BSD > > License > > @@ -25,16 +25,10 @@ > > **/ > > > > #include "UefiDpLib.h" > > -#include > > -#include > > -#include > > -#include > > - > > #include > > #include > > #include > > #include > > -#include > > #include > > > > #include > > @@ -153,8 +147,7 @@ ShellCommandRunDp ( > > CONST CHAR16 *CmdLineArg; > > EFI_STATUS Status; > > > > - UINT64 Freq; > > - UINT64 Ticker; > > + PERFORMANCE_PROPERTY *PerformanceProperty; > > UINTN Number2Display; > > > > EFI_STRING StringPtr; > > @@ -183,11 +176,6 @@ ShellCommandRunDp ( > > CustomCumulativeData =3D NULL; > > ShellStatus =3D SHELL_SUCCESS; > > > > - // Get DP's entry time as soon as possible. > > - // This is used as the Shell-Phase end time. > > - // > > - Ticker =3D GetPerformanceCounter (); > > - > > // > > // initialize the shell lib (we must be in non-auto-init...) > > // > > @@ -283,10 +271,15 @@ ShellCommandRunDp ( > > // StartCount =3D Value loaded into the counter when it starts co= unting > > // EndCount =3D Value counter counts to before it needs to be r= eset > > // > > - Freq =3D GetPerformanceCounterProperties (&TimerInfo.StartCount, > > &TimerInfo.EndCount); > > + Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid= , > > &PerformanceProperty); > > + if (EFI_ERROR (Status)) { > > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > > (STR_PERF_PROPERTY_NOT_FOUND), gDpHiiHandle); > > + goto Done; > > + } > > > > - // Convert the Frequency from Hz to KHz > > - TimerInfo.Frequency =3D (UINT32)DivU64x32 (Freq, 1000); > > + TimerInfo.Frequency =3D (UINT32)DivU64x32 > > (PerformanceProperty->Frequency, 1000); > > + TimerInfo.StartCount =3D PerformanceProperty->TimerStartValue; > > + TimerInfo.EndCount =3D PerformanceProperty->TimerEndValue; > > > > // Determine in which direction the performance counter counts. > > TimerInfo.CountUp =3D (BOOLEAN) (TimerInfo.EndCount >=3D > > TimerInfo.StartCount); > > @@ -362,7 +355,7 @@ ShellCommandRunDp ( > > } else { > > //------------- Begin Cooked Mode Processing > > if (TraceMode) { > > - ProcessPhases ( Ticker ); > > + ProcessPhases (); > > if ( ! SummaryMode) { > > Status =3D ProcessHandles ( ExcludeMode); > > if (Status =3D=3D EFI_ABORTED) { > > diff --git a/ShellPkg/Library/UefiDpLib/DpInternal.h > > b/ShellPkg/Library/UefiDpLib/DpInternal.h > > index b5ec5f0..6de194a 100644 > > --- a/ShellPkg/Library/UefiDpLib/DpInternal.h > > +++ b/ShellPkg/Library/UefiDpLib/DpInternal.h > > @@ -6,7 +6,7 @@ > > Dp application. In addition to global data, function declarations f= or > > DpUtilities.c, DpTrace.c, and DpProfile.c are included here. > > > > - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. > > + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > > (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of th= e BSD > > License > > @@ -236,12 +236,10 @@ DumpRawTrace( > > /** > > Gather and print Major Phase metrics. > > > > - @param[in] Ticker The timer value for the END of Shell phase > > - > > **/ > > VOID > > ProcessPhases( > > - IN UINT64 Ticker > > + VOID > > ); > > > > > > diff --git a/ShellPkg/Library/UefiDpLib/DpProfile.c > > b/ShellPkg/Library/UefiDpLib/DpProfile.c > > index 6458398..e443403 100644 > > --- a/ShellPkg/Library/UefiDpLib/DpProfile.c > > +++ b/ShellPkg/Library/UefiDpLib/DpProfile.c > > @@ -1,7 +1,7 @@ > > /** @file > > Measured Profiling reporting for the Dp utility. > > > > - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. > > + 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 th= e BSD > > License > > which accompanies this distribution. The full text of the license m= ay be > > found at > > @@ -16,7 +16,6 @@ > > #include > > #include > > #include > > -#include > > #include > > #include > > #include > > diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c > > b/ShellPkg/Library/UefiDpLib/DpTrace.c > > index eca2ef3..90a71ad 100644 > > --- a/ShellPkg/Library/UefiDpLib/DpTrace.c > > +++ b/ShellPkg/Library/UefiDpLib/DpTrace.c > > @@ -1,7 +1,7 @@ > > /** @file > > Trace reporting for the Dp utility. > > > > - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > > + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > > (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of th= e BSD > > License > > @@ -17,7 +17,6 @@ > > #include > > #include > > #include > > -#include > > #include > > #include > > #include > > @@ -386,12 +385,10 @@ DumpRawTrace( > > /** > > Gather and print Major Phase metrics. > > > > - @param[in] Ticker The timer value for the END of Shell phase > > - > > **/ > > VOID > > ProcessPhases( > > - IN UINT64 Ticker > > + VOID > > ) > > { > > MEASUREMENT_RECORD Measurement; > > @@ -400,7 +397,6 @@ ProcessPhases( > > UINT64 PeiTime; > > UINT64 DxeTime; > > UINT64 BdsTime; > > - UINT64 ShellTime; > > UINT64 ElapsedTime; > > UINT64 Duration; > > UINT64 Total; > > @@ -413,7 +409,6 @@ ProcessPhases( > > PeiTime =3D 0; > > DxeTime =3D 0; > > BdsTime =3D 0; > > - ShellTime =3D 0; > > // > > // Get Execution Phase Statistics > > // > > @@ -434,9 +429,6 @@ ProcessPhases( > > &Measurement.EndTimeStamp, > > &Measurement.Identifier)) !=3D 0) > > { > > - if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH= ) > > =3D=3D 0) { > > - Measurement.EndTimeStamp =3D Ticker; > > - } > > if (Measurement.EndTimeStamp =3D=3D 0) { // Skip "incomplete" reco= rds > > continue; > > } > > @@ -454,8 +446,6 @@ ProcessPhases( > > DxeTime =3D Duration; > > } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, > > PERF_TOKEN_LENGTH) =3D=3D 0) { > > BdsTime =3D Duration; > > - } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, > > PERF_TOKEN_LENGTH) =3D=3D 0) { > > - ShellTime =3D Duration; > > } > > } > > > > @@ -510,17 +500,6 @@ ProcessPhases( > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), > > gDpHiiHandle, ALit_BdsTO, ElapsedTime); > > } > > > > - // print SHELL phase duration time > > - // > > - if (ShellTime > 0) { > > - ElapsedTime =3D DivU64x32 ( > > - ShellTime, > > - (UINT32)TimerInfo.Frequency > > - ); > > - Total +=3D ElapsedTime; > > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION= ), > > gDpHiiHandle, ALit_SHELL, ElapsedTime); > > - } > > - > > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), > > gDpHiiHandle, Total); > > } > > > > diff --git a/ShellPkg/Library/UefiDpLib/DpUtilities.c > > b/ShellPkg/Library/UefiDpLib/DpUtilities.c > > index fbdd938..64f1830 100644 > > --- a/ShellPkg/Library/UefiDpLib/DpUtilities.c > > +++ b/ShellPkg/Library/UefiDpLib/DpUtilities.c > > @@ -1,7 +1,7 @@ > > /** @file > > Utility functions used by the Dp application. > > > > - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > > + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > > (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of th= e BSD > > License > > @@ -17,7 +17,6 @@ > > #include > > #include > > #include > > -#include > > #include > > #include > > #include > > diff --git a/ShellPkg/Library/UefiDpLib/Literals.c > > b/ShellPkg/Library/UefiDpLib/Literals.c > > index 68de0fb..c1cddfb 100644 > > --- a/ShellPkg/Library/UefiDpLib/Literals.c > > +++ b/ShellPkg/Library/UefiDpLib/Literals.c > > @@ -1,7 +1,7 @@ > > /** @file > > Definitions of ASCII string literals used by DP. > > > > - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. > > + 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 th= e BSD > > License > > which accompanies this distribution. The full text of the license m= ay be > > found at > > @@ -16,7 +16,6 @@ > > CHAR8 const ALit_TimerLibError[] =3D "Timer library instance error!\n"= ; > > CHAR8 const ALit_SEC[] =3D SEC_TOK; > > CHAR8 const ALit_DXE[] =3D DXE_TOK; > > -CHAR8 const ALit_SHELL[] =3D SHELL_TOK; > > CHAR8 const ALit_PEI[] =3D PEI_TOK; > > CHAR8 const ALit_BDS[] =3D BDS_TOK; > > CHAR8 const ALit_BdsTO[] =3D "BdsTimeOut"; > > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > > b/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > > index 70d2163..0bce0ce 100644 > > --- a/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > > +++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > > @@ -1,7 +1,7 @@ > > ## @file > > # Display Performance Application, Module information file. > > # > > -# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. > > +# 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 th= e BSD > > License > > # which accompanies this distribution. The full text of the license m= ay be > > found at > > @@ -48,7 +48,6 @@ > > MdeModulePkg/MdeModulePkg.dec > > > > [LibraryClasses] > > - TimerLib > > PerformanceLib > > DxeServicesLib > > MemoryAllocationLib > > @@ -64,6 +63,9 @@ > > PrintLib > > DevicePathLib > > > > +[Guids] > > + gPerformanceProtocolGuid ## > > CONSUMES ## SystemTable > > + > > [Protocols] > > gEfiLoadedImageProtocolGuid ## > > CONSUMES > > gEfiDriverBindingProtocolGuid ## > > SOMETIMES_CONSUMES > > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.uni > > b/ShellPkg/Library/UefiDpLib/UefiDpLib.uni > > index b092274..b77c507 100644 > > --- a/ShellPkg/Library/UefiDpLib/UefiDpLib.uni > > +++ b/ShellPkg/Library/UefiDpLib/UefiDpLib.uni > > @@ -1,7 +1,7 @@ > > // *++ > > // > > // (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P. > > -// Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<= BR> > > +// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<= BR> > > // (C) Copyright 2015 Hewlett Packard Enterprise Development LP
> > // This program and the accompanying materials > > // are licensed and made available under the terms and conditions of t= he BSD > > License > > @@ -35,6 +35,7 @@ > > #string STR_DP_INVALID_ARG #language en-US "Invalid > > argument(s)\n" > > #string STR_DP_HANDLES_ERROR #language en-US "Locate all > > handles error - %r\n" > > #string STR_DP_ERROR_NAME #language en-US "Unknown > > driver name" > > +#string STR_PERF_PROPERTY_NOT_FOUND #language en-US > > "Performance property not found\n" > > #string STR_DP_BUILD_REVISION #language en-US "\nDP Build > > Version: %d.%d\n" > > #string STR_DP_KHZ #language en-US "System > > Performance Timer Frequency: %,8d (KHz)\n" > > #string STR_DP_TIMER_PROPERTIES #language en-US "System > > Performance Timer counts %s from 0x%Lx to 0x%Lx\n" > > diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc > > index 6b7864b..5c01933 100644 > > --- a/ShellPkg/ShellPkg.dsc > > +++ b/ShellPkg/ShellPkg.dsc > > @@ -1,7 +1,7 @@ > > ## @file > > # Shell Package > > # > > -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved. > > +# Copyright (c) 2007 - 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 > > @@ -99,7 +99,6 @@ > > > > ShellPkg/Library/UefiDpLib/UefiDpLib.inf { > > > > - > > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTempla= te > > .inf > > > > PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLib > > Null.inf > > DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > > } > > -- > > 2.6.3.windows.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel