public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Remove TimerLib dependency from DP
@ 2017-02-03  4:55 Michael Kinney
  2017-02-03  4:55 ` [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table Michael Kinney
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Michael Kinney @ 2017-02-03  4:55 UTC (permalink / raw)
  To: edk2-devel
  Cc: Andrew Fish, Liming Gao, Jiewen Yao, Cinnamon Shia, Jaben Carsey,
	Star Zeng

Current DP implementation depends on TimerLib, as different platforms may 
implement and use their own TimerLib, it makes the dp needs to be built by 
platform. The TimerLib dependency can be removed by using performance property 
configuration table to make DP to be generic.

There was a discussion on edk2-devel about supporting use of different TimerLib
instances in different modules and updating the performance log to support
measurements with different timer rates.  A complete solution for this has
not been found.

This patch series that allows the DP command to get the timer rate from a
system configuration table is useful on its own because it allows the DP shell
command to be independent of the TimerLib used to collect the performance logs.

V3:
Define and install performance property configuration table instead of extending
PEI performance log HOB. As user may want to only dump DXE or SMM performance
data, then PeiPerformanceLib will be not linked and PEI performance log HOB
will be not built.

V4:
Change name of field in PERFORMANCE_PROPERTY from CpuFreq to Frequency.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>

Star Zeng (3):
  MdeModulePkg: Add performance property configuration table
  PerformancePkg Dp_App: Remove TimerLib dependency
  ShellPkg UefiDpLib: Remove TimerLib dependency

 MdeModulePkg/Include/Guid/Performance.h            | 12 +++++++-
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23 ++++++++++++--
 .../DxeCorePerformanceLib.inf                      |  2 ++
 .../DxeCorePerformanceLibInternal.h                |  3 +-
 .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18 +++++++++++
 .../SmmCorePerformanceLib.inf                      |  5 +++-
 PerformancePkg/Dp_App/Dp.c                         | 35 +++++++++++-----------
 PerformancePkg/Dp_App/Dp.inf                       |  6 ++--
 PerformancePkg/Dp_App/DpInternal.h                 |  6 ++--
 PerformancePkg/Dp_App/DpProfile.c                  |  3 +-
 PerformancePkg/Dp_App/DpStrings.uni                | 10 ++++---
 PerformancePkg/Dp_App/DpTrace.c                    | 25 ++--------------
 PerformancePkg/Dp_App/DpUtilities.c                |  3 +-
 PerformancePkg/Dp_App/Literals.c                   |  3 +-
 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 +-
 23 files changed, 117 insertions(+), 118 deletions(-)

-- 
2.6.3.windows.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table
  2017-02-03  4:55 [PATCH v4 0/3] Remove TimerLib dependency from DP Michael Kinney
@ 2017-02-03  4:55 ` Michael Kinney
  2017-02-03  5:32   ` Yao, Jiewen
  2017-02-03  4:55 ` [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency Michael Kinney
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Michael Kinney @ 2017-02-03  4:55 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Andrew Fish, Liming Gao, Jiewen Yao, Cinnamon Shia,
	Jaben Carsey

From: Star Zeng <star.zeng@intel.com>

Define PERFORMANCE_PROPERTY, and install performance property configuration
table in DxeCorePerformanceLib and SmmCorePerformanceLib.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Include/Guid/Performance.h            | 12 ++++++++++-
 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23 ++++++++++++++++++++--
 .../DxeCorePerformanceLib.inf                      |  2 ++
 .../DxeCorePerformanceLibInternal.h                |  3 ++-
 .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18 +++++++++++++++++
 .../SmmCorePerformanceLib.inf                      |  5 ++++-
 6 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/Performance.h b/MdeModulePkg/Include/Guid/Performance.h
index c40046c..df40c6c 100644
--- a/MdeModulePkg/Include/Guid/Performance.h
+++ b/MdeModulePkg/Include/Guid/Performance.h
@@ -4,7 +4,7 @@
   * performance protocol interfaces.
   * performance variables.  
 
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available under 
 the terms and conditions of the BSD License that accompanies this distribution.  
 The full text of the license may be found at
@@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __PERFORMANCE_DATA_H__
 #define __PERFORMANCE_DATA_H__
 
+#define PERFORMANCE_PROPERTY_REVISION 0x1
+
+typedef struct {
+  UINT32                Revision;
+  UINT32                Reserved;
+  UINT64                Frequency;
+  UINT64                TimerStartValue;
+  UINT64                TimerEndValue;
+} PERFORMANCE_PROPERTY;
+
 //
 // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
 //
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 4739bb8..1564514 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -10,7 +10,7 @@
   This library is mainly used by DxeCore to start performance logging to ensure that
   Performance Protocol is installed at the very beginning of DXE phase.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
   GetGaugeEx
   };
 
+PERFORMANCE_PROPERTY  mPerformanceProperty;
+
 /**
   Searches in the gauge array with keyword Handle, Token, Module and Identifier.
 
@@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
   )
 {
   EFI_STATUS                Status;
+  PERFORMANCE_PROPERTY      *PerformanceProperty;
+
 
   if (!PerformanceMeasurementEnabled ()) {
     //
@@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
 
   InternalGetPeiPerformance ();
 
-  return Status;
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
+  if (EFI_ERROR (Status)) {
+    //
+    // Install configuration table for performance property.
+    //
+    mPerformanceProperty.Revision  = PERFORMANCE_PROPERTY_REVISION;
+    mPerformanceProperty.Reserved  = 0;
+    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
+                                       &mPerformanceProperty.TimerStartValue,
+                                       &mPerformanceProperty.TimerEndValue
+                                       );
+    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, &mPerformanceProperty);
+    ASSERT_EFI_ERROR (Status);
+  }
+
+  return EFI_SUCCESS;
 }
 
 /**
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
index e091c62..5b89ce2 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
@@ -56,11 +56,13 @@
   BaseLib
   HobLib
   DebugLib
+  UefiLib
 
 
 [Guids]
   ## SOMETIMES_CONSUMES   ## HOB
   ## PRODUCES             ## UNDEFINED # Install protocol
+  ## PRODUCES             ## SystemTable
   gPerformanceProtocolGuid
   ## SOMETIMES_CONSUMES   ## HOB
   ## PRODUCES             ## UNDEFINED # Install protocol
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
index 2b9ccd2..f1540d8 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
@@ -4,7 +4,7 @@
   This header file holds the prototypes of the Performance and PerformanceEx Protocol published by this
   library instance at its constructor.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
 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
@@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PcdLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Library/UefiLib.h>
 
 //
 // Interface declarations for PerformanceEx Protocol.
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index 6f8d2dd..a03a8c8 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
   GetGaugeEx
 };
 
+PERFORMANCE_PROPERTY mPerformanceProperty;
+
 /**
   Searches in the gauge array with keyword Handle, Token, Module and Identfier.
 
@@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (
 {
   EFI_STATUS                Status;
   EFI_HANDLE                Handle;
+  PERFORMANCE_PROPERTY      *PerformanceProperty;
 
   //
   // Initialize spin lock
@@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
   ASSERT_EFI_ERROR (Status);
   Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx, &gSmmPerformanceExProtocolGuid, &Handle);
   ASSERT_EFI_ERROR (Status);
+
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
+  if (EFI_ERROR (Status)) {
+    //
+    // Install configuration table for performance property.
+    //
+    mPerformanceProperty.Revision  = PERFORMANCE_PROPERTY_REVISION;
+    mPerformanceProperty.Reserved  = 0;
+    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
+                                       &mPerformanceProperty.TimerStartValue,
+                                       &mPerformanceProperty.TimerEndValue
+                                       );
+    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid, &mPerformanceProperty);
+    ASSERT_EFI_ERROR (Status);
+  }
 }
 
 /**
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf
index 160a749..1b2fbd3 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf
@@ -8,7 +8,7 @@
 #  This library is mainly used by SMM Core to start performance logging to ensure that
 #  SMM Performance and PerformanceEx Protocol are installed at the very beginning of SMM phase.
 #  
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -57,6 +57,7 @@
   SynchronizationLib
   SmmServicesTableLib
   SmmMemLib
+  UefiLib
 
 [Protocols]
   gEfiSmmBase2ProtocolGuid                  ## CONSUMES
@@ -68,6 +69,8 @@
   ## PRODUCES ## UNDEFINED # Install protocol
   ## CONSUMES ## UNDEFINED # SmiHandlerRegister
   gSmmPerformanceExProtocolGuid
+  ## PRODUCES ## SystemTable
+  gPerformanceProtocolGuid
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask    ## CONSUMES
-- 
2.6.3.windows.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency
  2017-02-03  4:55 [PATCH v4 0/3] Remove TimerLib dependency from DP Michael Kinney
  2017-02-03  4:55 ` [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table Michael Kinney
@ 2017-02-03  4:55 ` Michael Kinney
  2017-02-03  5:34   ` Yao, Jiewen
  2017-02-03  4:55 ` [PATCH v4 3/3] ShellPkg UefiDpLib: " Michael Kinney
  2017-02-03 17:47 ` [PATCH v4 0/3] Remove TimerLib dependency from DP Carsey, Jaben
  3 siblings, 1 reply; 13+ messages in thread
From: Michael Kinney @ 2017-02-03  4:55 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Andrew Fish, Liming Gao, Jiewen Yao, Cinnamon Shia,
	Jaben Carsey

From: Star Zeng <star.zeng@intel.com>

Current Dp_App implementation depends on TimerLib,
as different platforms may implement and use their
own TimerLib, it makes the dp application needs to
be built by platform. The TimerLib dependency can
be removed by using performance property configuration
table to make Dp_App to be generic.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 PerformancePkg/Dp_App/Dp.c          | 35 +++++++++++++++++------------------
 PerformancePkg/Dp_App/Dp.inf        |  6 ++++--
 PerformancePkg/Dp_App/DpInternal.h  |  6 ++----
 PerformancePkg/Dp_App/DpProfile.c   |  3 +--
 PerformancePkg/Dp_App/DpStrings.uni | 10 ++++++----
 PerformancePkg/Dp_App/DpTrace.c     | 25 ++-----------------------
 PerformancePkg/Dp_App/DpUtilities.c |  3 +--
 PerformancePkg/Dp_App/Literals.c    |  3 +--
 8 files changed, 34 insertions(+), 57 deletions(-)

diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
index 26a3ebc..389f368 100644
--- a/PerformancePkg/Dp_App/Dp.c
+++ b/PerformancePkg/Dp_App/Dp.c
@@ -13,7 +13,7 @@
   Dp uses this information to group records in different ways.  It also uses
   timer information to calculate elapsed time for each measurement.
  
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -30,7 +30,6 @@
 #include <Library/BaseLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
 #include <Library/UefiLib.h>
 #include <Library/UefiHiiServicesLib.h>
 #include <Library/HiiLib.h>
@@ -201,14 +200,13 @@ InitializeDp (
   IN EFI_SYSTEM_TABLE         *SystemTable
   )
 {
-  UINT64                    Freq;
-  UINT64                    Ticker;
-  UINT32                    ListIndex;
-  
-  LIST_ENTRY                *ParamPackage;
-  CONST CHAR16              *CmdLineArg;
-  EFI_STRING                StringPtr;
-  UINTN                     Number2Display;
+  PERFORMANCE_PROPERTY          *PerformanceProperty;
+  UINT32                        ListIndex;
+
+  LIST_ENTRY                    *ParamPackage;
+  CONST CHAR16                  *CmdLineArg;
+  EFI_STRING                    StringPtr;
+  UINTN                         Number2Display;
 
   EFI_STATUS                    Status;
   BOOLEAN                       SummaryMode;
@@ -267,11 +265,6 @@ InitializeDp (
   StringDpOptionLc = NULL;
   StringPtr        = NULL;
 
-  // Get DP's entry time as soon as possible.
-  // This is used as the Shell-Phase end time.
-  //
-  Ticker  = GetPerformanceCounter ();
-
   //
   // Retrieve HII package list from ImageHandle
   //
@@ -406,10 +399,16 @@ InitializeDp (
       //    StartCount = Value loaded into the counter when it starts counting
       //      EndCount = Value counter counts to before it needs to be reset
       //
-      Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount);
+      Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
+      if (EFI_ERROR (Status)) {
+        PrintToken (STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND));
+        goto Done;
+      }
 
       // Convert the Frequency from Hz to KHz
-      TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000);
+      TimerInfo.Frequency  = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000);
+      TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
+      TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
 
       // Determine in which direction the performance counter counts.
       TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);
@@ -487,7 +486,7 @@ InitializeDp (
       else {
         //------------- Begin Cooked Mode Processing
         if (TraceMode) {
-          ProcessPhases ( Ticker );
+          ProcessPhases ();
           if ( ! SummaryMode) {
             Status = ProcessHandles ( ExcludeMode);
             if (Status == EFI_ABORTED) {
diff --git a/PerformancePkg/Dp_App/Dp.inf b/PerformancePkg/Dp_App/Dp.inf
index 8abc20f..1204d8e 100644
--- a/PerformancePkg/Dp_App/Dp.inf
+++ b/PerformancePkg/Dp_App/Dp.inf
@@ -1,7 +1,7 @@
 ##  @file
 #  Display Performance Application, Module information file.
 #
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 # 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
@@ -56,7 +56,6 @@
   MemoryAllocationLib
   DebugLib
   UefiBootServicesTableLib
-  TimerLib
   PeCoffGetEntryPointLib
   PerformanceLib
   PrintLib
@@ -67,6 +66,9 @@
   DevicePathLib
   DxeServicesLib
 
+[Guids]
+  gPerformanceProtocolGuid                                ## CONSUMES ## SystemTable
+
 [Protocols]
   gEfiLoadedImageProtocolGuid                             ## CONSUMES
   gEfiHiiPackageListProtocolGuid                          ## CONSUMES
diff --git a/PerformancePkg/Dp_App/DpInternal.h b/PerformancePkg/Dp_App/DpInternal.h
index 53c5fb2..1ab36ba 100644
--- a/PerformancePkg/Dp_App/DpInternal.h
+++ b/PerformancePkg/Dp_App/DpInternal.h
@@ -6,7 +6,7 @@
   Dp application.  In addition to global data, function declarations for
   DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -254,12 +254,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/PerformancePkg/Dp_App/DpProfile.c b/PerformancePkg/Dp_App/DpProfile.c
index eb5b3dd..15c2ef1 100644
--- a/PerformancePkg/Dp_App/DpProfile.c
+++ b/PerformancePkg/Dp_App/DpProfile.c
@@ -1,7 +1,7 @@
 /** @file
   Measured Profiling reporting for the Dp utility.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   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
@@ -16,7 +16,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PerformanceLib.h>
 #include <Library/PrintLib.h>
diff --git a/PerformancePkg/Dp_App/DpStrings.uni b/PerformancePkg/Dp_App/DpStrings.uni
index daaa242..131d16b 100644
--- a/PerformancePkg/Dp_App/DpStrings.uni
+++ b/PerformancePkg/Dp_App/DpStrings.uni
@@ -1,12 +1,12 @@
 // *++
 //
-// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 // (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
 // 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.
 //
@@ -114,7 +114,7 @@
                                        #language fr-FR  "   -n COUNT\n"
 #string STR_DP_HELP_ID                 #language en-US  "   -i  display identifier\n"
                                        #language fr-FR  "   -i\n"
-#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN - Display pre-defined and custom cumulative data\r\n" 
+#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN - Display pre-defined and custom cumulative data\r\n"
                                                         "              Pre-defined cumulative token are:\r\n"
                                                         "              1. LoadImage:\r\n"
                                                         "              2. StartImage:\r\n"
@@ -137,6 +137,8 @@
                                        #language fr-FR  "Localiser Toute erreur de Poignées - %r\n"
 #string STR_DP_ERROR_NAME              #language en-US  "Unknown Driver Name"
                                        #language fr-FR  "Unknown Driver Name"
+#string STR_PERF_PROPERTY_NOT_FOUND    #language en-US  "Performance property not found\n"
+                                       #language fr-FR  "Performance property not found\n"
 #string STR_DP_BUILD_REVISION          #language en-US  "\nDP Build Version:       %d.%d\n"
                                        #language fr-FR  "\nDP Construit la Version:         %d,%d\n"
 #string STR_DP_KHZ                     #language en-US  "System Performance Timer Frequency:   %,8d (KHz)\n"
@@ -238,7 +240,7 @@
 #string STR_DP_RAW_VARS2               #language en-US  "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"
                                        #language fr-FR  "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"
 #string STR_DP_RAW_HEADR2              #language en-US  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"
-                                       #language fr-FR  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"   
+                                       #language fr-FR  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"
 #string STR_DP_OPTION_UA               #language en-US  "-A"
                                        #language fr-FR  "-A"
 #string STR_DP_OPTION_LA               #language en-US  "-a"
diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c
index 6a62bba..9b4e0ed 100644
--- a/PerformancePkg/Dp_App/DpTrace.c
+++ b/PerformancePkg/Dp_App/DpTrace.c
@@ -1,7 +1,7 @@
 /** @file
   Trace reporting for the Dp utility.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PerformanceLib.h>
 #include <Library/PrintLib.h>
@@ -385,12 +384,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;
@@ -399,7 +396,6 @@ ProcessPhases(
   UINT64                    PeiTime;
   UINT64                    DxeTime;
   UINT64                    BdsTime;
-  UINT64                    ShellTime;
   UINT64                    ElapsedTime;
   UINT64                    Duration;
   UINT64                    Total;
@@ -412,7 +408,6 @@ ProcessPhases(
   PeiTime         = 0;
   DxeTime         = 0;
   BdsTime         = 0;
-  ShellTime       = 0;   
   //
   // Get Execution Phase Statistics
   //
@@ -433,9 +428,6 @@ ProcessPhases(
                           &Measurement.EndTimeStamp,
                           &Measurement.Identifier)) != 0)
   {
-    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
-      Measurement.EndTimeStamp = Ticker;
-    }
     if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
       continue;
     }
@@ -453,8 +445,6 @@ ProcessPhases(
       DxeTime      = Duration;
     } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0) {
       BdsTime      = Duration;
-    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
-      ShellTime    = Duration;
     }
   }
 
@@ -509,17 +499,6 @@ ProcessPhases(
     PrintToken (STRING_TOKEN (STR_DP_PHASE_BDSTO), ALit_BdsTO, ElapsedTime);
   }
 
-  // print SHELL phase duration time
-  //
-  if (ShellTime > 0) {
-    ElapsedTime = DivU64x32 (
-                    ShellTime,
-                    (UINT32)TimerInfo.Frequency
-                    );
-    Total += ElapsedTime;
-    PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_SHELL, ElapsedTime);
-  }
-
   PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);
 }
 
diff --git a/PerformancePkg/Dp_App/DpUtilities.c b/PerformancePkg/Dp_App/DpUtilities.c
index 13d3897..d5840e8 100644
--- a/PerformancePkg/Dp_App/DpUtilities.c
+++ b/PerformancePkg/Dp_App/DpUtilities.c
@@ -1,7 +1,7 @@
 /** @file
   Utility functions used by the Dp application.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PrintLib.h>
 #include <Library/HiiLib.h>
diff --git a/PerformancePkg/Dp_App/Literals.c b/PerformancePkg/Dp_App/Literals.c
index 68de0fb..c1cddfb 100644
--- a/PerformancePkg/Dp_App/Literals.c
+++ b/PerformancePkg/Dp_App/Literals.c
@@ -1,7 +1,7 @@
 /** @file
   Definitions of ASCII string literals used by DP.
 
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   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
@@ -16,7 +16,6 @@
 CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
 CHAR8 const ALit_SEC[]    = SEC_TOK;
 CHAR8 const ALit_DXE[]    = DXE_TOK;
-CHAR8 const ALit_SHELL[]  = SHELL_TOK;
 CHAR8 const ALit_PEI[]    = PEI_TOK;
 CHAR8 const ALit_BDS[]    = BDS_TOK;
 CHAR8 const ALit_BdsTO[]  = "BdsTimeOut";
-- 
2.6.3.windows.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
  2017-02-03  4:55 [PATCH v4 0/3] Remove TimerLib dependency from DP Michael Kinney
  2017-02-03  4:55 ` [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table Michael Kinney
  2017-02-03  4:55 ` [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency Michael Kinney
@ 2017-02-03  4:55 ` Michael Kinney
  2017-02-03  5:35   ` Yao, Jiewen
  2017-02-03 17:47 ` [PATCH v4 0/3] Remove TimerLib dependency from DP Carsey, Jaben
  3 siblings, 1 reply; 13+ messages in thread
From: Michael Kinney @ 2017-02-03  4:55 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Andrew Fish, Liming Gao, Jiewen Yao, Cinnamon Shia,
	Jaben Carsey

From: Star Zeng <star.zeng@intel.com>

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 <afish@apple.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 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/UefiDpLib/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 also uses
   timer information to calculate elapsed time for each measurement.
  
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -25,16 +25,10 @@
 **/
 
 #include "UefiDpLib.h"
-#include <Guid/GlobalVariable.h>
-#include <Library/PrintLib.h>
-#include <Library/HandleParsingLib.h>
-#include <Library/DevicePathLib.h>
-
 #include <Library/ShellLib.h>
 #include <Library/BaseLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
-#include <Library/TimerLib.h>
 #include <Library/UefiLib.h>
 
 #include <Guid/Performance.h>
@@ -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 = NULL;
   ShellStatus = SHELL_SUCCESS;
 
-  // Get DP's entry time as soon as possible.
-  // This is used as the Shell-Phase end time.
-  //
-  Ticker  = GetPerformanceCounter ();
-
   //
   // initialize the shell lib (we must be in non-auto-init...)
   //
@@ -283,10 +271,15 @@ ShellCommandRunDp (
   //    StartCount = Value loaded into the counter when it starts counting
   //      EndCount = Value counter counts to before it needs to be reset
   //
-  Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount);
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &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 = (UINT32)DivU64x32 (Freq, 1000);
+  TimerInfo.Frequency  = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000);
+  TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
+  TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
 
   // Determine in which direction the performance counter counts.
   TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);
@@ -362,7 +355,7 @@ ShellCommandRunDp (
   } else {
     //------------- Begin Cooked Mode Processing
     if (TraceMode) {
-      ProcessPhases ( Ticker );
+      ProcessPhases ();
       if ( ! SummaryMode) {
         Status = ProcessHandles ( ExcludeMode);
         if (Status == 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 for
   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<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the 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 the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -16,7 +16,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PerformanceLib.h>
 #include <Library/PrintLib.h>
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<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PerformanceLib.h>
 #include <Library/PrintLib.h>
@@ -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         = 0;
   DxeTime         = 0;
   BdsTime         = 0;
-  ShellTime       = 0;   
   //
   // Get Execution Phase Statistics
   //
@@ -434,9 +429,6 @@ ProcessPhases(
                           &Measurement.EndTimeStamp,
                           &Measurement.Identifier)) != 0)
   {
-    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
-      Measurement.EndTimeStamp = Ticker;
-    }
     if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
       continue;
     }
@@ -454,8 +446,6 @@ ProcessPhases(
       DxeTime      = Duration;
     } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0) {
       BdsTime      = Duration;
-    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
-      ShellTime    = 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 = DivU64x32 (
-                    ShellTime,
-                    (UINT32)TimerInfo.Frequency
-                    );
-    Total += 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<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
-#include <Library/TimerLib.h>
 #include <Library/PeCoffGetEntryPointLib.h>
 #include <Library/PrintLib.h>
 #include <Library/HiiLib.h>
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.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
   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
@@ -16,7 +16,6 @@
 CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
 CHAR8 const ALit_SEC[]    = SEC_TOK;
 CHAR8 const ALit_DXE[]    = DXE_TOK;
-CHAR8 const ALit_SHELL[]  = SHELL_TOK;
 CHAR8 const ALit_PEI[]    = PEI_TOK;
 CHAR8 const ALit_BDS[]    = BDS_TOK;
 CHAR8 const ALit_BdsTO[]  = "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 the BSD License
 # which accompanies this distribution.  The full text of the license may 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.<BR>
-// 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<BR>
 // This program and the accompanying materials
 // are licensed and made available under the terms and conditions of the 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.<BR>
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #    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 {
     <LibraryClasses>
-      TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
       PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
       DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   }
-- 
2.6.3.windows.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table
  2017-02-03  4:55 ` [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table Michael Kinney
@ 2017-02-03  5:32   ` Yao, Jiewen
  2017-02-23 17:30     ` Ard Biesheuvel
  0 siblings, 1 reply; 13+ messages in thread
From: Yao, Jiewen @ 2017-02-03  5:32 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Andrew Fish, Gao, Liming, Carsey, Jaben, Zeng, Star

Thank you Mike and Star.

It is good idea to remove TimerLib dependency.
Series Reviewed-by: Jiewen.yao@intel.com


> -----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 <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v4 1/3] MdeModulePkg: Add performance property
> configuration table
> 
> From: Star Zeng <star.zeng@intel.com>
> 
> Define PERFORMANCE_PROPERTY, and install performance property
> configuration
> table in DxeCorePerformanceLib and SmmCorePerformanceLib.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Include/Guid/Performance.h            | 12 ++++++++++-
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23
> ++++++++++++++++++++--
>  .../DxeCorePerformanceLib.inf                      |  2 ++
>  .../DxeCorePerformanceLibInternal.h                |  3 ++-
>  .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18
> +++++++++++++++++
>  .../SmmCorePerformanceLib.inf                      |  5 ++++-
>  6 files changed, 58 insertions(+), 5 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Guid/Performance.h
> b/MdeModulePkg/Include/Guid/Performance.h
> index c40046c..df40c6c 100644
> --- a/MdeModulePkg/Include/Guid/Performance.h
> +++ b/MdeModulePkg/Include/Guid/Performance.h
> @@ -4,7 +4,7 @@
>    * performance protocol interfaces.
>    * performance variables.
> 
> -Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>  This program and the accompanying materials are licensed and made available
> under
>  the terms and conditions of the BSD License that accompanies this distribution.
>  The full text of the license may be found at
> @@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
> KIND, EITHER EXPRESS OR IMPLIED.
>  #ifndef __PERFORMANCE_DATA_H__
>  #define __PERFORMANCE_DATA_H__
> 
> +#define PERFORMANCE_PROPERTY_REVISION 0x1
> +
> +typedef struct {
> +  UINT32                Revision;
> +  UINT32                Reserved;
> +  UINT64                Frequency;
> +  UINT64                TimerStartValue;
> +  UINT64                TimerEndValue;
> +} PERFORMANCE_PROPERTY;
> +
>  //
>  // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
>  //
> diff --git
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> index 4739bb8..1564514 100644
> ---
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> +++
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> @@ -10,7 +10,7 @@
>    This library is mainly used by DxeCore to start performance logging to ensure
> that
>    Performance Protocol is installed at the very beginning of DXE phase.
> 
> -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
> @@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface
> = {
>    GetGaugeEx
>    };
> 
> +PERFORMANCE_PROPERTY  mPerformanceProperty;
> +
>  /**
>    Searches in the gauge array with keyword Handle, Token, Module and
> Identifier.
> 
> @@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
>    )
>  {
>    EFI_STATUS                Status;
> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
> +
> 
>    if (!PerformanceMeasurementEnabled ()) {
>      //
> @@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
> 
>    InternalGetPeiPerformance ();
> 
> -  return Status;
> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> &PerformanceProperty);
> +  if (EFI_ERROR (Status)) {
> +    //
> +    // Install configuration table for performance property.
> +    //
> +    mPerformanceProperty.Revision  =
> PERFORMANCE_PROPERTY_REVISION;
> +    mPerformanceProperty.Reserved  = 0;
> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
> +
> &mPerformanceProperty.TimerStartValue,
> +
> &mPerformanceProperty.TimerEndValue
> +                                       );
> +    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid,
> &mPerformanceProperty);
> +    ASSERT_EFI_ERROR (Status);
> +  }
> +
> +  return EFI_SUCCESS;
>  }
> 
>  /**
> diff --git
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> index e091c62..5b89ce2 100644
> ---
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> +++
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> @@ -56,11 +56,13 @@
>    BaseLib
>    HobLib
>    DebugLib
> +  UefiLib
> 
> 
>  [Guids]
>    ## SOMETIMES_CONSUMES   ## HOB
>    ## PRODUCES             ## UNDEFINED # Install protocol
> +  ## PRODUCES             ## SystemTable
>    gPerformanceProtocolGuid
>    ## SOMETIMES_CONSUMES   ## HOB
>    ## PRODUCES             ## UNDEFINED # Install protocol
> diff --git
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
> ernal.h
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
> ernal.h
> index 2b9ccd2..f1540d8 100644
> ---
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
> ernal.h
> +++
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
> ernal.h
> @@ -4,7 +4,7 @@
>    This header file holds the prototypes of the Performance and PerformanceEx
> Protocol published by this
>    library instance at its constructor.
> 
> -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
>  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
> @@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
>  #include <Library/PcdLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
>  #include <Library/MemoryAllocationLib.h>
> +#include <Library/UefiLib.h>
> 
>  //
>  // Interface declarations for PerformanceEx Protocol.
> diff --git
> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
> c
> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
> c
> index 6f8d2dd..a03a8c8 100644
> ---
> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
> c
> +++
> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
> c
> @@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface
> = {
>    GetGaugeEx
>  };
> 
> +PERFORMANCE_PROPERTY mPerformanceProperty;
> +
>  /**
>    Searches in the gauge array with keyword Handle, Token, Module and
> Identfier.
> 
> @@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (
>  {
>    EFI_STATUS                Status;
>    EFI_HANDLE                Handle;
> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
> 
>    //
>    // Initialize spin lock
> @@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
>    ASSERT_EFI_ERROR (Status);
>    Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx,
> &gSmmPerformanceExProtocolGuid, &Handle);
>    ASSERT_EFI_ERROR (Status);
> +
> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> &PerformanceProperty);
> +  if (EFI_ERROR (Status)) {
> +    //
> +    // Install configuration table for performance property.
> +    //
> +    mPerformanceProperty.Revision  =
> PERFORMANCE_PROPERTY_REVISION;
> +    mPerformanceProperty.Reserved  = 0;
> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
> +
> &mPerformanceProperty.TimerStartValue,
> +
> &mPerformanceProperty.TimerEndValue
> +                                       );
> +    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid,
> &mPerformanceProperty);
> +    ASSERT_EFI_ERROR (Status);
> +  }
>  }
> 
>  /**
> diff --git
> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
> nf
> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
> nf
> index 160a749..1b2fbd3 100644
> ---
> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
> nf
> +++
> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
> nf
> @@ -8,7 +8,7 @@
>  #  This library is mainly used by SMM Core to start performance logging to
> ensure that
>  #  SMM Performance and PerformanceEx Protocol are installed at the very
> beginning of SMM phase.
>  #
> -#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
>  #  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
> @@ -57,6 +57,7 @@
>    SynchronizationLib
>    SmmServicesTableLib
>    SmmMemLib
> +  UefiLib
> 
>  [Protocols]
>    gEfiSmmBase2ProtocolGuid                  ## CONSUMES
> @@ -68,6 +69,8 @@
>    ## PRODUCES ## UNDEFINED # Install protocol
>    ## CONSUMES ## UNDEFINED # SmiHandlerRegister
>    gSmmPerformanceExProtocolGuid
> +  ## PRODUCES ## SystemTable
> +  gPerformanceProtocolGuid
> 
>  [Pcd]
>    gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask    ##
> CONSUMES
> --
> 2.6.3.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency
  2017-02-03  4:55 ` [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency Michael Kinney
@ 2017-02-03  5:34   ` Yao, Jiewen
  0 siblings, 0 replies; 13+ messages in thread
From: Yao, Jiewen @ 2017-02-03  5:34 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Andrew Fish, Gao, Liming, Carsey, Jaben, Zeng, Star

I have one more suggestion.
Can we use MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf as default one in DSC?

So that the binary built with default DSC can be used on any platform.

PerformancePkg.dsc:
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf



> -----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 <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib
> dependency
> 
> From: Star Zeng <star.zeng@intel.com>
> 
> Current Dp_App implementation depends on TimerLib,
> as different platforms may implement and use their
> own TimerLib, it makes the dp application needs to
> be built by platform. The TimerLib dependency can
> be removed by using performance property configuration
> table to make Dp_App to be generic.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  PerformancePkg/Dp_App/Dp.c          | 35
> +++++++++++++++++------------------
>  PerformancePkg/Dp_App/Dp.inf        |  6 ++++--
>  PerformancePkg/Dp_App/DpInternal.h  |  6 ++----
>  PerformancePkg/Dp_App/DpProfile.c   |  3 +--
>  PerformancePkg/Dp_App/DpStrings.uni | 10 ++++++----
>  PerformancePkg/Dp_App/DpTrace.c     | 25 ++-----------------------
>  PerformancePkg/Dp_App/DpUtilities.c |  3 +--
>  PerformancePkg/Dp_App/Literals.c    |  3 +--
>  8 files changed, 34 insertions(+), 57 deletions(-)
> 
> diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
> index 26a3ebc..389f368 100644
> --- a/PerformancePkg/Dp_App/Dp.c
> +++ b/PerformancePkg/Dp_App/Dp.c
> @@ -13,7 +13,7 @@
>    Dp uses this information to group records in different ways.  It also uses
>    timer information to calculate elapsed time for each measurement.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -30,7 +30,6 @@
>  #include <Library/BaseLib.h>
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/UefiLib.h>
>  #include <Library/UefiHiiServicesLib.h>
>  #include <Library/HiiLib.h>
> @@ -201,14 +200,13 @@ InitializeDp (
>    IN EFI_SYSTEM_TABLE         *SystemTable
>    )
>  {
> -  UINT64                    Freq;
> -  UINT64                    Ticker;
> -  UINT32                    ListIndex;
> -
> -  LIST_ENTRY                *ParamPackage;
> -  CONST CHAR16              *CmdLineArg;
> -  EFI_STRING                StringPtr;
> -  UINTN                     Number2Display;
> +  PERFORMANCE_PROPERTY          *PerformanceProperty;
> +  UINT32                        ListIndex;
> +
> +  LIST_ENTRY                    *ParamPackage;
> +  CONST CHAR16                  *CmdLineArg;
> +  EFI_STRING                    StringPtr;
> +  UINTN                         Number2Display;
> 
>    EFI_STATUS                    Status;
>    BOOLEAN                       SummaryMode;
> @@ -267,11 +265,6 @@ InitializeDp (
>    StringDpOptionLc = NULL;
>    StringPtr        = NULL;
> 
> -  // Get DP's entry time as soon as possible.
> -  // This is used as the Shell-Phase end time.
> -  //
> -  Ticker  = GetPerformanceCounter ();
> -
>    //
>    // Retrieve HII package list from ImageHandle
>    //
> @@ -406,10 +399,16 @@ InitializeDp (
>        //    StartCount = Value loaded into the counter when it starts counting
>        //      EndCount = Value counter counts to before it needs to be reset
>        //
> -      Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount,
> &TimerInfo.EndCount);
> +      Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> &PerformanceProperty);
> +      if (EFI_ERROR (Status)) {
> +        PrintToken (STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND));
> +        goto Done;
> +      }
> 
>        // Convert the Frequency from Hz to KHz
> -      TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000);
> +      TimerInfo.Frequency  = (UINT32)DivU64x32
> (PerformanceProperty->Frequency, 1000);
> +      TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
> +      TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
> 
>        // Determine in which direction the performance counter counts.
>        TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >=
> TimerInfo.StartCount);
> @@ -487,7 +486,7 @@ InitializeDp (
>        else {
>          //------------- Begin Cooked Mode Processing
>          if (TraceMode) {
> -          ProcessPhases ( Ticker );
> +          ProcessPhases ();
>            if ( ! SummaryMode) {
>              Status = ProcessHandles ( ExcludeMode);
>              if (Status == EFI_ABORTED) {
> diff --git a/PerformancePkg/Dp_App/Dp.inf b/PerformancePkg/Dp_App/Dp.inf
> index 8abc20f..1204d8e 100644
> --- a/PerformancePkg/Dp_App/Dp.inf
> +++ b/PerformancePkg/Dp_App/Dp.inf
> @@ -1,7 +1,7 @@
>  ##  @file
>  #  Display Performance Application, Module information file.
>  #
> -# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>  # 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
> @@ -56,7 +56,6 @@
>    MemoryAllocationLib
>    DebugLib
>    UefiBootServicesTableLib
> -  TimerLib
>    PeCoffGetEntryPointLib
>    PerformanceLib
>    PrintLib
> @@ -67,6 +66,9 @@
>    DevicePathLib
>    DxeServicesLib
> 
> +[Guids]
> +  gPerformanceProtocolGuid                                ##
> CONSUMES ## SystemTable
> +
>  [Protocols]
>    gEfiLoadedImageProtocolGuid                             ##
> CONSUMES
>    gEfiHiiPackageListProtocolGuid                          ## CONSUMES
> diff --git a/PerformancePkg/Dp_App/DpInternal.h
> b/PerformancePkg/Dp_App/DpInternal.h
> index 53c5fb2..1ab36ba 100644
> --- a/PerformancePkg/Dp_App/DpInternal.h
> +++ b/PerformancePkg/Dp_App/DpInternal.h
> @@ -6,7 +6,7 @@
>    Dp application.  In addition to global data, function declarations for
>    DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
> 
> -  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -254,12 +254,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/PerformancePkg/Dp_App/DpProfile.c
> b/PerformancePkg/Dp_App/DpProfile.c
> index eb5b3dd..15c2ef1 100644
> --- a/PerformancePkg/Dp_App/DpProfile.c
> +++ b/PerformancePkg/Dp_App/DpProfile.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Measured Profiling reporting for the Dp utility.
> 
> -  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    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
> @@ -16,7 +16,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PerformanceLib.h>
>  #include <Library/PrintLib.h>
> diff --git a/PerformancePkg/Dp_App/DpStrings.uni
> b/PerformancePkg/Dp_App/DpStrings.uni
> index daaa242..131d16b 100644
> --- a/PerformancePkg/Dp_App/DpStrings.uni
> +++ b/PerformancePkg/Dp_App/DpStrings.uni
> @@ -1,12 +1,12 @@
>  // *++
>  //
> -// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>  // (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  // 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.
>  //
> @@ -114,7 +114,7 @@
>                                         #language fr-FR  "   -n
> COUNT\n"
>  #string STR_DP_HELP_ID                 #language en-US  "   -i  display
> identifier\n"
>                                         #language fr-FR  "   -i\n"
> -#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN
> - Display pre-defined and custom cumulative data\r\n"
> +#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN
> - Display pre-defined and custom cumulative data\r\n"
>                                                          "
> Pre-defined cumulative token are:\r\n"
>                                                          "
> 1. LoadImage:\r\n"
>                                                          "
> 2. StartImage:\r\n"
> @@ -137,6 +137,8 @@
>                                         #language fr-FR  "Localiser Toute
> erreur de Poignées - %r\n"
>  #string STR_DP_ERROR_NAME              #language en-US  "Unknown
> Driver Name"
>                                         #language fr-FR  "Unknown
> Driver Name"
> +#string STR_PERF_PROPERTY_NOT_FOUND    #language en-US
> "Performance property not found\n"
> +                                       #language fr-FR  "Performance
> property not found\n"
>  #string STR_DP_BUILD_REVISION          #language en-US  "\nDP Build
> Version:       %d.%d\n"
>                                         #language fr-FR  "\nDP Construit
> la Version:         %d,%d\n"
>  #string STR_DP_KHZ                     #language en-US  "System
> Performance Timer Frequency:   %,8d (KHz)\n"
> @@ -238,7 +240,7 @@
>  #string STR_DP_RAW_VARS2               #language en-US
> "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"
>                                         #language fr-FR
> "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"
>  #string STR_DP_RAW_HEADR2              #language en-US  "\nIndex
> Handle        Start Count       End Count                  Token
> Module                   ID\n"
> -                                       #language fr-FR  "\nIndex
> Handle        Start Count       End Count                  Token
> Module                   ID\n"
> +                                       #language fr-FR  "\nIndex
> Handle        Start Count       End Count                  Token
> Module                   ID\n"
>  #string STR_DP_OPTION_UA               #language en-US  "-A"
>                                         #language fr-FR  "-A"
>  #string STR_DP_OPTION_LA               #language en-US  "-a"
> diff --git a/PerformancePkg/Dp_App/DpTrace.c
> b/PerformancePkg/Dp_App/DpTrace.c
> index 6a62bba..9b4e0ed 100644
> --- a/PerformancePkg/Dp_App/DpTrace.c
> +++ b/PerformancePkg/Dp_App/DpTrace.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Trace reporting for the Dp utility.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -17,7 +17,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PerformanceLib.h>
>  #include <Library/PrintLib.h>
> @@ -385,12 +384,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;
> @@ -399,7 +396,6 @@ ProcessPhases(
>    UINT64                    PeiTime;
>    UINT64                    DxeTime;
>    UINT64                    BdsTime;
> -  UINT64                    ShellTime;
>    UINT64                    ElapsedTime;
>    UINT64                    Duration;
>    UINT64                    Total;
> @@ -412,7 +408,6 @@ ProcessPhases(
>    PeiTime         = 0;
>    DxeTime         = 0;
>    BdsTime         = 0;
> -  ShellTime       = 0;
>    //
>    // Get Execution Phase Statistics
>    //
> @@ -433,9 +428,6 @@ ProcessPhases(
>                            &Measurement.EndTimeStamp,
>                            &Measurement.Identifier)) != 0)
>    {
> -    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH)
> == 0) {
> -      Measurement.EndTimeStamp = Ticker;
> -    }
>      if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
>        continue;
>      }
> @@ -453,8 +445,6 @@ ProcessPhases(
>        DxeTime      = Duration;
>      } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS,
> PERF_TOKEN_LENGTH) == 0) {
>        BdsTime      = Duration;
> -    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL,
> PERF_TOKEN_LENGTH) == 0) {
> -      ShellTime    = Duration;
>      }
>    }
> 
> @@ -509,17 +499,6 @@ ProcessPhases(
>      PrintToken (STRING_TOKEN (STR_DP_PHASE_BDSTO), ALit_BdsTO,
> ElapsedTime);
>    }
> 
> -  // print SHELL phase duration time
> -  //
> -  if (ShellTime > 0) {
> -    ElapsedTime = DivU64x32 (
> -                    ShellTime,
> -                    (UINT32)TimerInfo.Frequency
> -                    );
> -    Total += ElapsedTime;
> -    PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_SHELL,
> ElapsedTime);
> -  }
> -
>    PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);
>  }
> 
> diff --git a/PerformancePkg/Dp_App/DpUtilities.c
> b/PerformancePkg/Dp_App/DpUtilities.c
> index 13d3897..d5840e8 100644
> --- a/PerformancePkg/Dp_App/DpUtilities.c
> +++ b/PerformancePkg/Dp_App/DpUtilities.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Utility functions used by the Dp application.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -17,7 +17,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PrintLib.h>
>  #include <Library/HiiLib.h>
> diff --git a/PerformancePkg/Dp_App/Literals.c
> b/PerformancePkg/Dp_App/Literals.c
> index 68de0fb..c1cddfb 100644
> --- a/PerformancePkg/Dp_App/Literals.c
> +++ b/PerformancePkg/Dp_App/Literals.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Definitions of ASCII string literals used by DP.
> 
> -  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    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
> @@ -16,7 +16,6 @@
>  CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
>  CHAR8 const ALit_SEC[]    = SEC_TOK;
>  CHAR8 const ALit_DXE[]    = DXE_TOK;
> -CHAR8 const ALit_SHELL[]  = SHELL_TOK;
>  CHAR8 const ALit_PEI[]    = PEI_TOK;
>  CHAR8 const ALit_BDS[]    = BDS_TOK;
>  CHAR8 const ALit_BdsTO[]  = "BdsTimeOut";
> --
> 2.6.3.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
  2017-02-03  4:55 ` [PATCH v4 3/3] ShellPkg UefiDpLib: " Michael Kinney
@ 2017-02-03  5:35   ` Yao, Jiewen
  2017-02-03 17:36     ` Kinney, Michael D
  0 siblings, 1 reply; 13+ messages in thread
From: Yao, Jiewen @ 2017-02-03  5:35 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Andrew Fish, Gao, Liming, Carsey, Jaben, Zeng, Star

I have one more suggestion.
Can we use MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf as default one in DSC?

So that the binary built with default DSC can be used on any platform.

ShellPkg.dsc:
   ShellPkg/Library/UefiDpLib/UefiDpLib.inf {
     <LibraryClasses>
-      TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
       PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
       DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   }


Thank you
Yao Jiewen


> -----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 <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
> 
> From: Star Zeng <star.zeng@intel.com>
> 
> 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 <afish@apple.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  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/UefiDpLib/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 also uses
>    timer information to calculate elapsed time for each measurement.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
>    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -25,16 +25,10 @@
>  **/
> 
>  #include "UefiDpLib.h"
> -#include <Guid/GlobalVariable.h>
> -#include <Library/PrintLib.h>
> -#include <Library/HandleParsingLib.h>
> -#include <Library/DevicePathLib.h>
> -
>  #include <Library/ShellLib.h>
>  #include <Library/BaseLib.h>
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/UefiLib.h>
> 
>  #include <Guid/Performance.h>
> @@ -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 = NULL;
>    ShellStatus = SHELL_SUCCESS;
> 
> -  // Get DP's entry time as soon as possible.
> -  // This is used as the Shell-Phase end time.
> -  //
> -  Ticker  = GetPerformanceCounter ();
> -
>    //
>    // initialize the shell lib (we must be in non-auto-init...)
>    //
> @@ -283,10 +271,15 @@ ShellCommandRunDp (
>    //    StartCount = Value loaded into the counter when it starts counting
>    //      EndCount = Value counter counts to before it needs to be reset
>    //
> -  Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount,
> &TimerInfo.EndCount);
> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> &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 = (UINT32)DivU64x32 (Freq, 1000);
> +  TimerInfo.Frequency  = (UINT32)DivU64x32
> (PerformanceProperty->Frequency, 1000);
> +  TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
> +  TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
> 
>    // Determine in which direction the performance counter counts.
>    TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >=
> TimerInfo.StartCount);
> @@ -362,7 +355,7 @@ ShellCommandRunDp (
>    } else {
>      //------------- Begin Cooked Mode Processing
>      if (TraceMode) {
> -      ProcessPhases ( Ticker );
> +      ProcessPhases ();
>        if ( ! SummaryMode) {
>          Status = ProcessHandles ( ExcludeMode);
>          if (Status == 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 for
>    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<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the 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 the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at
> @@ -16,7 +16,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PerformanceLib.h>
>  #include <Library/PrintLib.h>
> 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<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -17,7 +17,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PerformanceLib.h>
>  #include <Library/PrintLib.h>
> @@ -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         = 0;
>    DxeTime         = 0;
>    BdsTime         = 0;
> -  ShellTime       = 0;
>    //
>    // Get Execution Phase Statistics
>    //
> @@ -434,9 +429,6 @@ ProcessPhases(
>                            &Measurement.EndTimeStamp,
>                            &Measurement.Identifier)) != 0)
>    {
> -    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH)
> == 0) {
> -      Measurement.EndTimeStamp = Ticker;
> -    }
>      if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
>        continue;
>      }
> @@ -454,8 +446,6 @@ ProcessPhases(
>        DxeTime      = Duration;
>      } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS,
> PERF_TOKEN_LENGTH) == 0) {
>        BdsTime      = Duration;
> -    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL,
> PERF_TOKEN_LENGTH) == 0) {
> -      ShellTime    = 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 = DivU64x32 (
> -                    ShellTime,
> -                    (UINT32)TimerInfo.Frequency
> -                    );
> -    Total += 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<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -17,7 +17,6 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/UefiBootServicesTableLib.h>
> -#include <Library/TimerLib.h>
>  #include <Library/PeCoffGetEntryPointLib.h>
>  #include <Library/PrintLib.h>
>  #include <Library/HiiLib.h>
> 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.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>    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
> @@ -16,7 +16,6 @@
>  CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
>  CHAR8 const ALit_SEC[]    = SEC_TOK;
>  CHAR8 const ALit_DXE[]    = DXE_TOK;
> -CHAR8 const ALit_SHELL[]  = SHELL_TOK;
>  CHAR8 const ALit_PEI[]    = PEI_TOK;
>  CHAR8 const ALit_BDS[]    = BDS_TOK;
>  CHAR8 const ALit_BdsTO[]  = "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 the BSD
> License
>  # which accompanies this distribution.  The full text of the license may 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.<BR>
> -// 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<BR>
>  // This program and the accompanying materials
>  // are licensed and made available under the terms and conditions of the 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.<BR>
> +# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
>  #
>  #    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 {
>      <LibraryClasses>
> -
> TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate
> .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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
  2017-02-03  5:35   ` Yao, Jiewen
@ 2017-02-03 17:36     ` Kinney, Michael D
  2017-02-04  0:32       ` Yao, Jiewen
  0 siblings, 1 reply; 13+ messages in thread
From: Kinney, Michael D @ 2017-02-03 17:36 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org, Kinney, Michael D
  Cc: Andrew Fish, Gao, Liming, Carsey, Jaben, Zeng, Star

Jiewen,

If we do this, then we would also need to update all the 
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 <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
> Cc: Andrew Fish <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
> 
> I have one more suggestion.
> Can we use MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf as
> default one in DSC?
> 
> So that the binary built with default DSC can be used on any platform.
> 
> ShellPkg.dsc:
>    ShellPkg/Library/UefiDpLib/UefiDpLib.inf {
>      <LibraryClasses>
> -      TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
> 
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
>        DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
>    }
> 
> 
> Thank you
> Yao Jiewen
> 
> 
> > -----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 <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
> > Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng,
> > Star <star.zeng@intel.com>
> > Subject: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
> >
> > From: Star Zeng <star.zeng@intel.com>
> >
> > 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 <afish@apple.com>
> > Cc: Michael Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
> > Cc: Jaben Carsey <jaben.carsey@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Star Zeng <star.zeng@intel.com>
> > ---
> >  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/UefiDpLib/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 also uses
> >    timer information to calculate elapsed time for each measurement.
> >
> > -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> > +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
> >    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -25,16 +25,10 @@
> >  **/
> >
> >  #include "UefiDpLib.h"
> > -#include <Guid/GlobalVariable.h>
> > -#include <Library/PrintLib.h>
> > -#include <Library/HandleParsingLib.h>
> > -#include <Library/DevicePathLib.h>
> > -
> >  #include <Library/ShellLib.h>
> >  #include <Library/BaseLib.h>
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/UefiLib.h>
> >
> >  #include <Guid/Performance.h>
> > @@ -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 = NULL;
> >    ShellStatus = SHELL_SUCCESS;
> >
> > -  // Get DP's entry time as soon as possible.
> > -  // This is used as the Shell-Phase end time.
> > -  //
> > -  Ticker  = GetPerformanceCounter ();
> > -
> >    //
> >    // initialize the shell lib (we must be in non-auto-init...)
> >    //
> > @@ -283,10 +271,15 @@ ShellCommandRunDp (
> >    //    StartCount = Value loaded into the counter when it starts counting
> >    //      EndCount = Value counter counts to before it needs to be reset
> >    //
> > -  Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount,
> > &TimerInfo.EndCount);
> > +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> > &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 = (UINT32)DivU64x32 (Freq, 1000);
> > +  TimerInfo.Frequency  = (UINT32)DivU64x32
> > (PerformanceProperty->Frequency, 1000);
> > +  TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
> > +  TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
> >
> >    // Determine in which direction the performance counter counts.
> >    TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >=
> > TimerInfo.StartCount);
> > @@ -362,7 +355,7 @@ ShellCommandRunDp (
> >    } else {
> >      //------------- Begin Cooked Mode Processing
> >      if (TraceMode) {
> > -      ProcessPhases ( Ticker );
> > +      ProcessPhases ();
> >        if ( ! SummaryMode) {
> >          Status = ProcessHandles ( ExcludeMode);
> >          if (Status == 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 for
> >    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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the 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 the BSD
> > License
> >    which accompanies this distribution.  The full text of the license may be
> > found at
> > @@ -16,7 +16,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PerformanceLib.h>
> >  #include <Library/PrintLib.h>
> > 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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -17,7 +17,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PerformanceLib.h>
> >  #include <Library/PrintLib.h>
> > @@ -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         = 0;
> >    DxeTime         = 0;
> >    BdsTime         = 0;
> > -  ShellTime       = 0;
> >    //
> >    // Get Execution Phase Statistics
> >    //
> > @@ -434,9 +429,6 @@ ProcessPhases(
> >                            &Measurement.EndTimeStamp,
> >                            &Measurement.Identifier)) != 0)
> >    {
> > -    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH)
> > == 0) {
> > -      Measurement.EndTimeStamp = Ticker;
> > -    }
> >      if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
> >        continue;
> >      }
> > @@ -454,8 +446,6 @@ ProcessPhases(
> >        DxeTime      = Duration;
> >      } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS,
> > PERF_TOKEN_LENGTH) == 0) {
> >        BdsTime      = Duration;
> > -    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL,
> > PERF_TOKEN_LENGTH) == 0) {
> > -      ShellTime    = 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 = DivU64x32 (
> > -                    ShellTime,
> > -                    (UINT32)TimerInfo.Frequency
> > -                    );
> > -    Total += 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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -17,7 +17,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PrintLib.h>
> >  #include <Library/HiiLib.h>
> > 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.<BR>
> > +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> >    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
> > @@ -16,7 +16,6 @@
> >  CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
> >  CHAR8 const ALit_SEC[]    = SEC_TOK;
> >  CHAR8 const ALit_DXE[]    = DXE_TOK;
> > -CHAR8 const ALit_SHELL[]  = SHELL_TOK;
> >  CHAR8 const ALit_PEI[]    = PEI_TOK;
> >  CHAR8 const ALit_BDS[]    = BDS_TOK;
> >  CHAR8 const ALit_BdsTO[]  = "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 the BSD
> > License
> >  # which accompanies this distribution.  The full text of the license may 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.<BR>
> > -// 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<BR>
> >  // This program and the accompanying materials
> >  // are licensed and made available under the terms and conditions of the 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.<BR>
> > +# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
> >  #
> >  #    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 {
> >      <LibraryClasses>
> > -
> > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate
> > .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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 0/3] Remove TimerLib dependency from DP
  2017-02-03  4:55 [PATCH v4 0/3] Remove TimerLib dependency from DP Michael Kinney
                   ` (2 preceding siblings ...)
  2017-02-03  4:55 ` [PATCH v4 3/3] ShellPkg UefiDpLib: " Michael Kinney
@ 2017-02-03 17:47 ` Carsey, Jaben
  2017-02-08 18:19   ` Andrew Fish
  3 siblings, 1 reply; 13+ messages in thread
From: Carsey, Jaben @ 2017-02-03 17:47 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Andrew Fish, Gao, Liming, Yao, Jiewen, Zeng, Star, Carsey, Jaben

I am good with this change.  I like the idea of changing platforms that build the shell from source in a separate patch series.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Michael Kinney
> Sent: Thursday, February 2, 2017 8:56 PM
> To: edk2-devel@lists.01.org
> Cc: Andrew Fish <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v4 0/3] Remove TimerLib dependency from DP
> Importance: High
> 
> Current DP implementation depends on TimerLib, as different platforms may
> implement and use their own TimerLib, it makes the dp needs to be built by
> platform. The TimerLib dependency can be removed by using performance
> property configuration table to make DP to be generic.
> 
> There was a discussion on edk2-devel about supporting use of different TimerLib
> instances in different modules and updating the performance log to support
> measurements with different timer rates.  A complete solution for this has not
> been found.
> 
> This patch series that allows the DP command to get the timer rate from a
> system configuration table is useful on its own because it allows the DP shell
> command to be independent of the TimerLib used to collect the performance
> logs.
> 
> V3:
> Define and install performance property configuration table instead of
> extending PEI performance log HOB. As user may want to only dump DXE or
> SMM performance data, then PeiPerformanceLib will be not linked and PEI
> performance log HOB will be not built.
> 
> V4:
> Change name of field in PERFORMANCE_PROPERTY from CpuFreq to Frequency.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> 
> Star Zeng (3):
>   MdeModulePkg: Add performance property configuration table
>   PerformancePkg Dp_App: Remove TimerLib dependency
>   ShellPkg UefiDpLib: Remove TimerLib dependency
> 
>  MdeModulePkg/Include/Guid/Performance.h            | 12 +++++++-
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23 ++++++++++++--
>  .../DxeCorePerformanceLib.inf                      |  2 ++
>  .../DxeCorePerformanceLibInternal.h                |  3 +-
>  .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18 +++++++++++
>  .../SmmCorePerformanceLib.inf                      |  5 +++-
>  PerformancePkg/Dp_App/Dp.c                         | 35 +++++++++++-----------
>  PerformancePkg/Dp_App/Dp.inf                       |  6 ++--
>  PerformancePkg/Dp_App/DpInternal.h                 |  6 ++--
>  PerformancePkg/Dp_App/DpProfile.c                  |  3 +-
>  PerformancePkg/Dp_App/DpStrings.uni                | 10 ++++---
>  PerformancePkg/Dp_App/DpTrace.c                    | 25 ++--------------
>  PerformancePkg/Dp_App/DpUtilities.c                |  3 +-
>  PerformancePkg/Dp_App/Literals.c                   |  3 +-
>  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 +-
>  23 files changed, 117 insertions(+), 118 deletions(-)
> 
> --
> 2.6.3.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
  2017-02-03 17:36     ` Kinney, Michael D
@ 2017-02-04  0:32       ` Yao, Jiewen
  0 siblings, 0 replies; 13+ messages in thread
From: Yao, Jiewen @ 2017-02-04  0:32 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Andrew Fish, Gao, Liming, Carsey, Jaben, Zeng, Star

Sure, it is OK to enable this in a different patch series.

The V4 series is good enough and I have given Reviewed-by.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Saturday, February 4, 2017 1:36 AM
To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org; Kinney, Michael D <michael.d.kinney@intel.com>
Cc: Andrew Fish <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency

Jiewen,

If we do this, then we would also need to update all the
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 <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Andrew Fish <afish@apple.com<mailto:afish@apple.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Carsey, Jaben
> <jaben.carsey@intel.com<mailto:jaben.carsey@intel.com>>; Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>
> Subject: RE: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
>
> I have one more suggestion.
> Can we use MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf as
> default one in DSC?
>
> So that the binary built with default DSC can be used on any platform.
>
> ShellPkg.dsc:
>    ShellPkg/Library/UefiDpLib/UefiDpLib.inf {
>      <LibraryClasses>
> -      TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
>
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
>        DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
>    }
>
>
> Thank you
> Yao Jiewen
>
>
> > -----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<mailto:edk2-devel@lists.01.org>
> > Cc: Andrew Fish <afish@apple.com<mailto:afish@apple.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Yao,
> > Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Carsey, Jaben <jaben.carsey@intel.com<mailto:jaben.carsey@intel.com>>; Zeng,
> > Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>
> > Subject: [edk2] [PATCH v4 3/3] ShellPkg UefiDpLib: Remove TimerLib dependency
> >
> > From: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>>
> >
> > 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 <afish@apple.com<mailto:afish@apple.com>>
> > Cc: Michael Kinney <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>
> > Cc: Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>>
> > Cc: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
> > Cc: Cinnamon Shia <cinnamon.shia@hpe.com<mailto:cinnamon.shia@hpe.com>>
> > Cc: Jaben Carsey <jaben.carsey@intel.com<mailto:jaben.carsey@intel.com>>
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>>
> > ---
> >  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/UefiDpLib/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 also uses
> >    timer information to calculate elapsed time for each measurement.
> >
> > -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> > +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
> >    (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -25,16 +25,10 @@
> >  **/
> >
> >  #include "UefiDpLib.h"
> > -#include <Guid/GlobalVariable.h>
> > -#include <Library/PrintLib.h>
> > -#include <Library/HandleParsingLib.h>
> > -#include <Library/DevicePathLib.h>
> > -
> >  #include <Library/ShellLib.h>
> >  #include <Library/BaseLib.h>
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/UefiLib.h>
> >
> >  #include <Guid/Performance.h>
> > @@ -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 = NULL;
> >    ShellStatus = SHELL_SUCCESS;
> >
> > -  // Get DP's entry time as soon as possible.
> > -  // This is used as the Shell-Phase end time.
> > -  //
> > -  Ticker  = GetPerformanceCounter ();
> > -
> >    //
> >    // initialize the shell lib (we must be in non-auto-init...)
> >    //
> > @@ -283,10 +271,15 @@ ShellCommandRunDp (
> >    //    StartCount = Value loaded into the counter when it starts counting
> >    //      EndCount = Value counter counts to before it needs to be reset
> >    //
> > -  Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount,
> > &TimerInfo.EndCount);
> > +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
> > &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 = (UINT32)DivU64x32 (Freq, 1000);
> > +  TimerInfo.Frequency  = (UINT32)DivU64x32
> > (PerformanceProperty->Frequency, 1000);
> > +  TimerInfo.StartCount = PerformanceProperty->TimerStartValue;
> > +  TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;
> >
> >    // Determine in which direction the performance counter counts.
> >    TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >=
> > TimerInfo.StartCount);
> > @@ -362,7 +355,7 @@ ShellCommandRunDp (
> >    } else {
> >      //------------- Begin Cooked Mode Processing
> >      if (TraceMode) {
> > -      ProcessPhases ( Ticker );
> > +      ProcessPhases ();
> >        if ( ! SummaryMode) {
> >          Status = ProcessHandles ( ExcludeMode);
> >          if (Status == 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 for
> >    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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the 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 the BSD
> > License
> >    which accompanies this distribution.  The full text of the license may be
> > found at
> > @@ -16,7 +16,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PerformanceLib.h>
> >  #include <Library/PrintLib.h>
> > 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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -17,7 +17,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PerformanceLib.h>
> >  #include <Library/PrintLib.h>
> > @@ -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         = 0;
> >    DxeTime         = 0;
> >    BdsTime         = 0;
> > -  ShellTime       = 0;
> >    //
> >    // Get Execution Phase Statistics
> >    //
> > @@ -434,9 +429,6 @@ ProcessPhases(
> >                            &Measurement.EndTimeStamp,
> >                            &Measurement.Identifier)) != 0)
> >    {
> > -    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH)
> > == 0) {
> > -      Measurement.EndTimeStamp = Ticker;
> > -    }
> >      if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records
> >        continue;
> >      }
> > @@ -454,8 +446,6 @@ ProcessPhases(
> >        DxeTime      = Duration;
> >      } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS,
> > PERF_TOKEN_LENGTH) == 0) {
> >        BdsTime      = Duration;
> > -    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL,
> > PERF_TOKEN_LENGTH) == 0) {
> > -      ShellTime    = 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 = DivU64x32 (
> > -                    ShellTime,
> > -                    (UINT32)TimerInfo.Frequency
> > -                    );
> > -    Total += 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<BR>
> >    This program and the accompanying materials
> >    are licensed and made available under the terms and conditions of the BSD
> > License
> > @@ -17,7 +17,6 @@
> >  #include <Library/MemoryAllocationLib.h>
> >  #include <Library/DebugLib.h>
> >  #include <Library/UefiBootServicesTableLib.h>
> > -#include <Library/TimerLib.h>
> >  #include <Library/PeCoffGetEntryPointLib.h>
> >  #include <Library/PrintLib.h>
> >  #include <Library/HiiLib.h>
> > 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.<BR>
> > +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> >    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
> > @@ -16,7 +16,6 @@
> >  CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";
> >  CHAR8 const ALit_SEC[]    = SEC_TOK;
> >  CHAR8 const ALit_DXE[]    = DXE_TOK;
> > -CHAR8 const ALit_SHELL[]  = SHELL_TOK;
> >  CHAR8 const ALit_PEI[]    = PEI_TOK;
> >  CHAR8 const ALit_BDS[]    = BDS_TOK;
> >  CHAR8 const ALit_BdsTO[]  = "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 the BSD
> > License
> >  # which accompanies this distribution.  The full text of the license may 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.<BR>
> > -// 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<BR>
> >  // This program and the accompanying materials
> >  // are licensed and made available under the terms and conditions of the 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.<BR>
> > +# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
> >  #
> >  #    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 {
> >      <LibraryClasses>
> > -
> > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate
> > .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<mailto:edk2-devel@lists.01.org>
> > https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 0/3] Remove TimerLib dependency from DP
  2017-02-03 17:47 ` [PATCH v4 0/3] Remove TimerLib dependency from DP Carsey, Jaben
@ 2017-02-08 18:19   ` Andrew Fish
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Fish @ 2017-02-08 18:19 UTC (permalink / raw)
  To: Carsey, Jaben
  Cc: Mike Kinney, edk2-devel@lists.01.org, Gao, Liming, Yao, Jiewen,
	Zeng, Star


> On Feb 3, 2017, at 9:47 AM, Carsey, Jaben <jaben.carsey@intel.com> wrote:
> 
> I am good with this change.  I like the idea of changing platforms that build the shell from source in a separate patch series.
> 
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> 

Mike,

This looks good. 

 Reviewed-by: Andrew Fish <afish@apple.com <mailto:afish@apple.com>>

Thanks,

Andrew Fish

>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Michael Kinney
>> Sent: Thursday, February 2, 2017 8:56 PM
>> To: edk2-devel@lists.01.org
>> Cc: Andrew Fish <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
>> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
>> Zeng, Star <star.zeng@intel.com>
>> Subject: [edk2] [PATCH v4 0/3] Remove TimerLib dependency from DP
>> Importance: High
>> 
>> Current DP implementation depends on TimerLib, as different platforms may
>> implement and use their own TimerLib, it makes the dp needs to be built by
>> platform. The TimerLib dependency can be removed by using performance
>> property configuration table to make DP to be generic.
>> 
>> There was a discussion on edk2-devel about supporting use of different TimerLib
>> instances in different modules and updating the performance log to support
>> measurements with different timer rates.  A complete solution for this has not
>> been found.
>> 
>> This patch series that allows the DP command to get the timer rate from a
>> system configuration table is useful on its own because it allows the DP shell
>> command to be independent of the TimerLib used to collect the performance
>> logs.
>> 
>> V3:
>> Define and install performance property configuration table instead of
>> extending PEI performance log HOB. As user may want to only dump DXE or
>> SMM performance data, then PeiPerformanceLib will be not linked and PEI
>> performance log HOB will be not built.
>> 
>> V4:
>> Change name of field in PERFORMANCE_PROPERTY from CpuFreq to Frequency.
>> 
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Michael Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
>> Cc: Jaben Carsey <jaben.carsey@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Star Zeng <star.zeng@intel.com>
>> 
>> Star Zeng (3):
>>  MdeModulePkg: Add performance property configuration table
>>  PerformancePkg Dp_App: Remove TimerLib dependency
>>  ShellPkg UefiDpLib: Remove TimerLib dependency
>> 
>> MdeModulePkg/Include/Guid/Performance.h            | 12 +++++++-
>> .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23 ++++++++++++--
>> .../DxeCorePerformanceLib.inf                      |  2 ++
>> .../DxeCorePerformanceLibInternal.h                |  3 +-
>> .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18 +++++++++++
>> .../SmmCorePerformanceLib.inf                      |  5 +++-
>> PerformancePkg/Dp_App/Dp.c                         | 35 +++++++++++-----------
>> PerformancePkg/Dp_App/Dp.inf                       |  6 ++--
>> PerformancePkg/Dp_App/DpInternal.h                 |  6 ++--
>> PerformancePkg/Dp_App/DpProfile.c                  |  3 +-
>> PerformancePkg/Dp_App/DpStrings.uni                | 10 ++++---
>> PerformancePkg/Dp_App/DpTrace.c                    | 25 ++--------------
>> PerformancePkg/Dp_App/DpUtilities.c                |  3 +-
>> PerformancePkg/Dp_App/Literals.c                   |  3 +-
>> 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 +-
>> 23 files changed, 117 insertions(+), 118 deletions(-)
>> 
>> --
>> 2.6.3.windows.1
>> 
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table
  2017-02-03  5:32   ` Yao, Jiewen
@ 2017-02-23 17:30     ` Ard Biesheuvel
  2017-02-24  1:32       ` Zeng, Star
  0 siblings, 1 reply; 13+ messages in thread
From: Ard Biesheuvel @ 2017-02-23 17:30 UTC (permalink / raw)
  To: Yao, Jiewen
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Carsey, Jaben,
	Zeng, Star, Andrew Fish, Gao, Liming

On 3 February 2017 at 05:32, Yao, Jiewen <jiewen.yao@intel.com> wrote:
> Thank you Mike and Star.
>
> It is good idea to remove TimerLib dependency.
> Series Reviewed-by: Jiewen.yao@intel.com
>

This patch breaks the GCC build:

<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:
In function 'DxeCorePerformanceLibConstructor':
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:538:3:
error: passing argument 2 of 'EfiGetSystemConfigurationTable' from
incompatible pointer type [-Werror]
   Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
&PerformanceProperty);
   ^
In file included from
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h>:35:0,
                 from
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:26:
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdePkg/Include/Library/UefiLib.h>:135:1:
note: expected 'void **' but argument is of type 'struct
PERFORMANCE_PROPERTY **'
 EfiGetSystemConfigurationTable (
 ^

This fixes it for me:

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 1564514518d3..5438bd086144 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -535,7 +535,7 @@ DxeCorePerformanceLibConstructor (

   InternalGetPeiPerformance ();

-  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
&PerformanceProperty);
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
(VOID **)&PerformanceProperty);
   if (EFI_ERROR (Status)) {
     //
     // Install configuration table for performance property.


Thanks,
Ard,


>
>> -----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 <afish@apple.com>; Gao, Liming <liming.gao@intel.com>; Yao,
>> Jiewen <jiewen.yao@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>; Zeng,
>> Star <star.zeng@intel.com>
>> Subject: [edk2] [PATCH v4 1/3] MdeModulePkg: Add performance property
>> configuration table
>>
>> From: Star Zeng <star.zeng@intel.com>
>>
>> Define PERFORMANCE_PROPERTY, and install performance property
>> configuration
>> table in DxeCorePerformanceLib and SmmCorePerformanceLib.
>>
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Michael Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
>> Cc: Jaben Carsey <jaben.carsey@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Star Zeng <star.zeng@intel.com>
>> ---
>>  MdeModulePkg/Include/Guid/Performance.h            | 12 ++++++++++-
>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23
>> ++++++++++++++++++++--
>>  .../DxeCorePerformanceLib.inf                      |  2 ++
>>  .../DxeCorePerformanceLibInternal.h                |  3 ++-
>>  .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18
>> +++++++++++++++++
>>  .../SmmCorePerformanceLib.inf                      |  5 ++++-
>>  6 files changed, 58 insertions(+), 5 deletions(-)
>>
>> diff --git a/MdeModulePkg/Include/Guid/Performance.h
>> b/MdeModulePkg/Include/Guid/Performance.h
>> index c40046c..df40c6c 100644
>> --- a/MdeModulePkg/Include/Guid/Performance.h
>> +++ b/MdeModulePkg/Include/Guid/Performance.h
>> @@ -4,7 +4,7 @@
>>    * performance protocol interfaces.
>>    * performance variables.
>>
>> -Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
>> +Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>>  This program and the accompanying materials are licensed and made available
>> under
>>  the terms and conditions of the BSD License that accompanies this distribution.
>>  The full text of the license may be found at
>> @@ -18,6 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
>> KIND, EITHER EXPRESS OR IMPLIED.
>>  #ifndef __PERFORMANCE_DATA_H__
>>  #define __PERFORMANCE_DATA_H__
>>
>> +#define PERFORMANCE_PROPERTY_REVISION 0x1
>> +
>> +typedef struct {
>> +  UINT32                Revision;
>> +  UINT32                Reserved;
>> +  UINT64                Frequency;
>> +  UINT64                TimerStartValue;
>> +  UINT64                TimerEndValue;
>> +} PERFORMANCE_PROPERTY;
>> +
>>  //
>>  // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
>>  //
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> index 4739bb8..1564514 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> @@ -10,7 +10,7 @@
>>    This library is mainly used by DxeCore to start performance logging to ensure
>> that
>>    Performance Protocol is installed at the very beginning of DXE phase.
>>
>> -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
>> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
>>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>>  This program and the accompanying materials
>>  are licensed and made available under the terms and conditions of the BSD
>> License
>> @@ -61,6 +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface
>> = {
>>    GetGaugeEx
>>    };
>>
>> +PERFORMANCE_PROPERTY  mPerformanceProperty;
>> +
>>  /**
>>    Searches in the gauge array with keyword Handle, Token, Module and
>> Identifier.
>>
>> @@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
>>    )
>>  {
>>    EFI_STATUS                Status;
>> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
>> +
>>
>>    if (!PerformanceMeasurementEnabled ()) {
>>      //
>> @@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
>>
>>    InternalGetPeiPerformance ();
>>
>> -  return Status;
>> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
>> &PerformanceProperty);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // Install configuration table for performance property.
>> +    //
>> +    mPerformanceProperty.Revision  =
>> PERFORMANCE_PROPERTY_REVISION;
>> +    mPerformanceProperty.Reserved  = 0;
>> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
>> +
>> &mPerformanceProperty.TimerStartValue,
>> +
>> &mPerformanceProperty.TimerEndValue
>> +                                       );
>> +    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid,
>> &mPerformanceProperty);
>> +    ASSERT_EFI_ERROR (Status);
>> +  }
>> +
>> +  return EFI_SUCCESS;
>>  }
>>
>>  /**
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
>> index e091c62..5b89ce2 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
>> @@ -56,11 +56,13 @@
>>    BaseLib
>>    HobLib
>>    DebugLib
>> +  UefiLib
>>
>>
>>  [Guids]
>>    ## SOMETIMES_CONSUMES   ## HOB
>>    ## PRODUCES             ## UNDEFINED # Install protocol
>> +  ## PRODUCES             ## SystemTable
>>    gPerformanceProtocolGuid
>>    ## SOMETIMES_CONSUMES   ## HOB
>>    ## PRODUCES             ## UNDEFINED # Install protocol
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> index 2b9ccd2..f1540d8 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> @@ -4,7 +4,7 @@
>>    This header file holds the prototypes of the Performance and PerformanceEx
>> Protocol published by this
>>    library instance at its constructor.
>>
>> -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
>> +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
>>  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
>> @@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
>> EITHER EXPRESS OR IMPLIED.
>>  #include <Library/PcdLib.h>
>>  #include <Library/UefiBootServicesTableLib.h>
>>  #include <Library/MemoryAllocationLib.h>
>> +#include <Library/UefiLib.h>
>>
>>  //
>>  // Interface declarations for PerformanceEx Protocol.
>> diff --git
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> index 6f8d2dd..a03a8c8 100644
>> ---
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> +++
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> @@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface
>> = {
>>    GetGaugeEx
>>  };
>>
>> +PERFORMANCE_PROPERTY mPerformanceProperty;
>> +
>>  /**
>>    Searches in the gauge array with keyword Handle, Token, Module and
>> Identfier.
>>
>> @@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (
>>  {
>>    EFI_STATUS                Status;
>>    EFI_HANDLE                Handle;
>> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
>>
>>    //
>>    // Initialize spin lock
>> @@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
>>    ASSERT_EFI_ERROR (Status);
>>    Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx,
>> &gSmmPerformanceExProtocolGuid, &Handle);
>>    ASSERT_EFI_ERROR (Status);
>> +
>> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
>> &PerformanceProperty);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // Install configuration table for performance property.
>> +    //
>> +    mPerformanceProperty.Revision  =
>> PERFORMANCE_PROPERTY_REVISION;
>> +    mPerformanceProperty.Reserved  = 0;
>> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
>> +
>> &mPerformanceProperty.TimerStartValue,
>> +
>> &mPerformanceProperty.TimerEndValue
>> +                                       );
>> +    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid,
>> &mPerformanceProperty);
>> +    ASSERT_EFI_ERROR (Status);
>> +  }
>>  }
>>
>>  /**
>> diff --git
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> index 160a749..1b2fbd3 100644
>> ---
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> +++
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> @@ -8,7 +8,7 @@
>>  #  This library is mainly used by SMM Core to start performance logging to
>> ensure that
>>  #  SMM Performance and PerformanceEx Protocol are installed at the very
>> beginning of SMM phase.
>>  #
>> -#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
>> +#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
>>  #  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
>> @@ -57,6 +57,7 @@
>>    SynchronizationLib
>>    SmmServicesTableLib
>>    SmmMemLib
>> +  UefiLib
>>
>>  [Protocols]
>>    gEfiSmmBase2ProtocolGuid                  ## CONSUMES
>> @@ -68,6 +69,8 @@
>>    ## PRODUCES ## UNDEFINED # Install protocol
>>    ## CONSUMES ## UNDEFINED # SmiHandlerRegister
>>    gSmmPerformanceExProtocolGuid
>> +  ## PRODUCES ## SystemTable
>> +  gPerformanceProtocolGuid
>>
>>  [Pcd]
>>    gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask    ##
>> CONSUMES
>> --
>> 2.6.3.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table
  2017-02-23 17:30     ` Ard Biesheuvel
@ 2017-02-24  1:32       ` Zeng, Star
  0 siblings, 0 replies; 13+ messages in thread
From: Zeng, Star @ 2017-02-24  1:32 UTC (permalink / raw)
  To: Ard Biesheuvel, Yao, Jiewen
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Carsey, Jaben,
	Andrew Fish, Gao, Liming, Zeng, Star

Agree, I will send patch for it ASAP.

Thanks,
Star
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] 
Sent: Friday, February 24, 2017 1:30 AM
To: Yao, Jiewen <jiewen.yao@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org; Carsey, Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>; Andrew Fish <afish@apple.com>; Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table

On 3 February 2017 at 05:32, Yao, Jiewen <jiewen.yao@intel.com> wrote:
> Thank you Mike and Star.
>
> It is good idea to remove TimerLib dependency.
> Series Reviewed-by: Jiewen.yao@intel.com
>

This patch breaks the GCC build:

<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:
In function 'DxeCorePerformanceLibConstructor':
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:538:3:
error: passing argument 2 of 'EfiGetSystemConfigurationTable' from incompatible pointer type [-Werror]
   Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
   ^
In file included from
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h>:35:0,
                 from
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c>:26:
<https://ci.linaro.org/jenkins/job/leg-virt-tianocore-edk2-upstream/ws/edk2/MdePkg/Include/Library/UefiLib.h>:135:1:
note: expected 'void **' but argument is of type 'struct PERFORMANCE_PROPERTY **'
 EfiGetSystemConfigurationTable (
 ^

This fixes it for me:

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 1564514518d3..5438bd086144 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -535,7 +535,7 @@ DxeCorePerformanceLibConstructor (

   InternalGetPeiPerformance ();

-  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);
+  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
(VOID **)&PerformanceProperty);
   if (EFI_ERROR (Status)) {
     //
     // Install configuration table for performance property.


Thanks,
Ard,


>
>> -----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 <afish@apple.com>; Gao, Liming 
>> <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Carsey, 
>> Jaben <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>
>> Subject: [edk2] [PATCH v4 1/3] MdeModulePkg: Add performance property 
>> configuration table
>>
>> From: Star Zeng <star.zeng@intel.com>
>>
>> Define PERFORMANCE_PROPERTY, and install performance property 
>> configuration table in DxeCorePerformanceLib and 
>> SmmCorePerformanceLib.
>>
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Michael Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <liming.gao@intel.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Cinnamon Shia <cinnamon.shia@hpe.com>
>> Cc: Jaben Carsey <jaben.carsey@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Star Zeng <star.zeng@intel.com>
>> ---
>>  MdeModulePkg/Include/Guid/Performance.h            | 12 ++++++++++-
>>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 23
>> ++++++++++++++++++++--
>>  .../DxeCorePerformanceLib.inf                      |  2 ++
>>  .../DxeCorePerformanceLibInternal.h                |  3 ++-
>>  .../SmmCorePerformanceLib/SmmCorePerformanceLib.c  | 18
>> +++++++++++++++++
>>  .../SmmCorePerformanceLib.inf                      |  5 ++++-
>>  6 files changed, 58 insertions(+), 5 deletions(-)
>>
>> diff --git a/MdeModulePkg/Include/Guid/Performance.h
>> b/MdeModulePkg/Include/Guid/Performance.h
>> index c40046c..df40c6c 100644
>> --- a/MdeModulePkg/Include/Guid/Performance.h
>> +++ b/MdeModulePkg/Include/Guid/Performance.h
>> @@ -4,7 +4,7 @@
>>    * performance protocol interfaces.
>>    * performance variables.
>>
>> -Copyright (c) 2009 - 2013, Intel Corporation. All rights 
>> reserved.<BR>
>> +Copyright (c) 2009 - 2017, Intel Corporation. All rights 
>> +reserved.<BR>
>>  This program and the accompanying materials are licensed and made 
>> available under  the terms and conditions of the BSD License that 
>> accompanies this distribution.
>>  The full text of the license may be found at @@ -18,6 +18,16 @@ 
>> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
>> IMPLIED.
>>  #ifndef __PERFORMANCE_DATA_H__
>>  #define __PERFORMANCE_DATA_H__
>>
>> +#define PERFORMANCE_PROPERTY_REVISION 0x1
>> +
>> +typedef struct {
>> +  UINT32                Revision;
>> +  UINT32                Reserved;
>> +  UINT64                Frequency;
>> +  UINT64                TimerStartValue;
>> +  UINT64                TimerEndValue;
>> +} PERFORMANCE_PROPERTY;
>> +
>>  //
>>  // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
>>  //
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> index 4739bb8..1564514 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>> @@ -10,7 +10,7 @@
>>    This library is mainly used by DxeCore to start performance 
>> logging to ensure that
>>    Performance Protocol is installed at the very beginning of DXE phase.
>>
>> -Copyright (c) 2006 - 2016, Intel Corporation. All rights 
>> reserved.<BR>
>> +Copyright (c) 2006 - 2017, Intel Corporation. All rights 
>> +reserved.<BR>
>>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  
>> This program and the accompanying materials  are licensed and made 
>> available under the terms and conditions of the BSD License @@ -61,6 
>> +61,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
>>    GetGaugeEx
>>    };
>>
>> +PERFORMANCE_PROPERTY  mPerformanceProperty;
>> +
>>  /**
>>    Searches in the gauge array with keyword Handle, Token, Module and 
>> Identifier.
>>
>> @@ -502,6 +504,8 @@ DxeCorePerformanceLibConstructor (
>>    )
>>  {
>>    EFI_STATUS                Status;
>> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
>> +
>>
>>    if (!PerformanceMeasurementEnabled ()) {
>>      //
>> @@ -531,7 +535,22 @@ DxeCorePerformanceLibConstructor (
>>
>>    InternalGetPeiPerformance ();
>>
>> -  return Status;
>> +  Status = EfiGetSystemConfigurationTable 
>> + (&gPerformanceProtocolGuid,
>> &PerformanceProperty);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // Install configuration table for performance property.
>> +    //
>> +    mPerformanceProperty.Revision  =
>> PERFORMANCE_PROPERTY_REVISION;
>> +    mPerformanceProperty.Reserved  = 0;
>> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties 
>> + (
>> +
>> &mPerformanceProperty.TimerStartValue,
>> +
>> &mPerformanceProperty.TimerEndValue
>> +                                       );
>> +    Status = gBS->InstallConfigurationTable 
>> + (&gPerformanceProtocolGuid,
>> &mPerformanceProperty);
>> +    ASSERT_EFI_ERROR (Status);
>> +  }
>> +
>> +  return EFI_SUCCESS;
>>  }
>>
>>  /**
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.in
>> f 
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.in
>> f
>> index e091c62..5b89ce2 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.in
>> f
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.in
>> f
>> @@ -56,11 +56,13 @@
>>    BaseLib
>>    HobLib
>>    DebugLib
>> +  UefiLib
>>
>>
>>  [Guids]
>>    ## SOMETIMES_CONSUMES   ## HOB
>>    ## PRODUCES             ## UNDEFINED # Install protocol
>> +  ## PRODUCES             ## SystemTable
>>    gPerformanceProtocolGuid
>>    ## SOMETIMES_CONSUMES   ## HOB
>>    ## PRODUCES             ## UNDEFINED # Install protocol
>> diff --git
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> index 2b9ccd2..f1540d8 100644
>> ---
>> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> +++
>> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInt
>> ernal.h
>> @@ -4,7 +4,7 @@
>>    This header file holds the prototypes of the Performance and 
>> PerformanceEx Protocol published by this
>>    library instance at its constructor.
>>
>> -Copyright (c) 2006 - 2012, Intel Corporation. All rights 
>> reserved.<BR>
>> +Copyright (c) 2006 - 2017, Intel Corporation. All rights 
>> +reserved.<BR>
>>  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 @@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF 
>> ANY KIND, EITHER EXPRESS OR IMPLIED.
>>  #include <Library/PcdLib.h>
>>  #include <Library/UefiBootServicesTableLib.h>
>>  #include <Library/MemoryAllocationLib.h>
>> +#include <Library/UefiLib.h>
>>
>>  //
>>  // Interface declarations for PerformanceEx Protocol.
>> diff --git
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> index 6f8d2dd..a03a8c8 100644
>> ---
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> +++
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>> c
>> @@ -69,6 +69,8 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
>>    GetGaugeEx
>>  };
>>
>> +PERFORMANCE_PROPERTY mPerformanceProperty;
>> +
>>  /**
>>    Searches in the gauge array with keyword Handle, Token, Module and 
>> Identfier.
>>
>> @@ -687,6 +689,7 @@ InitializeSmmCorePerformanceLib (  {
>>    EFI_STATUS                Status;
>>    EFI_HANDLE                Handle;
>> +  PERFORMANCE_PROPERTY      *PerformanceProperty;
>>
>>    //
>>    // Initialize spin lock
>> @@ -725,6 +728,21 @@ InitializeSmmCorePerformanceLib (
>>    ASSERT_EFI_ERROR (Status);
>>    Status = gSmst->SmiHandlerRegister (SmmPerformanceHandlerEx,
>> &gSmmPerformanceExProtocolGuid, &Handle);
>>    ASSERT_EFI_ERROR (Status);
>> +
>> +  Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid,
>> &PerformanceProperty);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // Install configuration table for performance property.
>> +    //
>> +    mPerformanceProperty.Revision  =
>> PERFORMANCE_PROPERTY_REVISION;
>> +    mPerformanceProperty.Reserved  = 0;
>> +    mPerformanceProperty.Frequency = GetPerformanceCounterProperties (
>> +
>> &mPerformanceProperty.TimerStartValue,
>> +
>> &mPerformanceProperty.TimerEndValue
>> +                                       );
>> +    Status = gBS->InstallConfigurationTable (&gPerformanceProtocolGuid,
>> &mPerformanceProperty);
>> +    ASSERT_EFI_ERROR (Status);
>> +  }
>>  }
>>
>>  /**
>> diff --git
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> index 160a749..1b2fbd3 100644
>> ---
>> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> +++
>> b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i
>> nf
>> @@ -8,7 +8,7 @@
>>  #  This library is mainly used by SMM Core to start performance logging to
>> ensure that
>>  #  SMM Performance and PerformanceEx Protocol are installed at the very
>> beginning of SMM phase.
>>  #
>> -#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
>> +#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
>>  #  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
>> @@ -57,6 +57,7 @@
>>    SynchronizationLib
>>    SmmServicesTableLib
>>    SmmMemLib
>> +  UefiLib
>>
>>  [Protocols]
>>    gEfiSmmBase2ProtocolGuid                  ## CONSUMES
>> @@ -68,6 +69,8 @@
>>    ## PRODUCES ## UNDEFINED # Install protocol
>>    ## CONSUMES ## UNDEFINED # SmiHandlerRegister
>>    gSmmPerformanceExProtocolGuid
>> +  ## PRODUCES ## SystemTable
>> +  gPerformanceProtocolGuid
>>
>>  [Pcd]
>>    gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask    ##
>> CONSUMES
>> --
>> 2.6.3.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-24  1:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03  4:55 [PATCH v4 0/3] Remove TimerLib dependency from DP Michael Kinney
2017-02-03  4:55 ` [PATCH v4 1/3] MdeModulePkg: Add performance property configuration table Michael Kinney
2017-02-03  5:32   ` Yao, Jiewen
2017-02-23 17:30     ` Ard Biesheuvel
2017-02-24  1:32       ` Zeng, Star
2017-02-03  4:55 ` [PATCH v4 2/3] PerformancePkg Dp_App: Remove TimerLib dependency Michael Kinney
2017-02-03  5:34   ` Yao, Jiewen
2017-02-03  4:55 ` [PATCH v4 3/3] ShellPkg UefiDpLib: " Michael Kinney
2017-02-03  5:35   ` Yao, Jiewen
2017-02-03 17:36     ` Kinney, Michael D
2017-02-04  0:32       ` Yao, Jiewen
2017-02-03 17:47 ` [PATCH v4 0/3] Remove TimerLib dependency from DP Carsey, Jaben
2017-02-08 18:19   ` Andrew Fish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox