]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PerformancePkg Dp_App: Remove TimerLib dependency
authorStar Zeng <star.zeng@intel.com>
Wed, 8 Jun 2016 07:30:22 +0000 (00:30 -0700)
committerMichael Kinney <michael.d.kinney@intel.com>
Thu, 23 Feb 2017 17:01:24 +0000 (09:01 -0800)
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>
Reviewed-by: Andrew Fish <afish@apple.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
PerformancePkg/Dp_App/Dp.c
PerformancePkg/Dp_App/Dp.inf
PerformancePkg/Dp_App/DpInternal.h
PerformancePkg/Dp_App/DpProfile.c
PerformancePkg/Dp_App/DpStrings.uni
PerformancePkg/Dp_App/DpTrace.c
PerformancePkg/Dp_App/DpUtilities.c
PerformancePkg/Dp_App/Literals.c

index 26a3ebcd1d0755ee86920252fe06f7dee85ba46e..389f3681e9f933112c6925d61c3c435878b3e3f7 100644 (file)
@@ -13,7 +13,7 @@
   Dp uses this information to group records in different ways.  It also uses\r
   timer information to calculate elapsed time for each measurement.\r
  \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -30,7 +30,6 @@
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/UefiHiiServicesLib.h>\r
 #include <Library/HiiLib.h>\r
@@ -201,14 +200,13 @@ InitializeDp (
   IN EFI_SYSTEM_TABLE         *SystemTable\r
   )\r
 {\r
-  UINT64                    Freq;\r
-  UINT64                    Ticker;\r
-  UINT32                    ListIndex;\r
-  \r
-  LIST_ENTRY                *ParamPackage;\r
-  CONST CHAR16              *CmdLineArg;\r
-  EFI_STRING                StringPtr;\r
-  UINTN                     Number2Display;\r
+  PERFORMANCE_PROPERTY          *PerformanceProperty;\r
+  UINT32                        ListIndex;\r
+\r
+  LIST_ENTRY                    *ParamPackage;\r
+  CONST CHAR16                  *CmdLineArg;\r
+  EFI_STRING                    StringPtr;\r
+  UINTN                         Number2Display;\r
 \r
   EFI_STATUS                    Status;\r
   BOOLEAN                       SummaryMode;\r
@@ -267,11 +265,6 @@ InitializeDp (
   StringDpOptionLc = NULL;\r
   StringPtr        = NULL;\r
 \r
-  // Get DP's entry time as soon as possible.\r
-  // This is used as the Shell-Phase end time.\r
-  //\r
-  Ticker  = GetPerformanceCounter ();\r
-\r
   //\r
   // Retrieve HII package list from ImageHandle\r
   //\r
@@ -406,10 +399,16 @@ InitializeDp (
       //    StartCount = Value loaded into the counter when it starts counting\r
       //      EndCount = Value counter counts to before it needs to be reset\r
       //\r
-      Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount);\r
+      Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, &PerformanceProperty);\r
+      if (EFI_ERROR (Status)) {\r
+        PrintToken (STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOUND));\r
+        goto Done;\r
+      }\r
 \r
       // Convert the Frequency from Hz to KHz\r
-      TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000);\r
+      TimerInfo.Frequency  = (UINT32)DivU64x32 (PerformanceProperty->Frequency, 1000);\r
+      TimerInfo.StartCount = PerformanceProperty->TimerStartValue;\r
+      TimerInfo.EndCount   = PerformanceProperty->TimerEndValue;\r
 \r
       // Determine in which direction the performance counter counts.\r
       TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);\r
@@ -487,7 +486,7 @@ InitializeDp (
       else {\r
         //------------- Begin Cooked Mode Processing\r
         if (TraceMode) {\r
-          ProcessPhases ( Ticker );\r
+          ProcessPhases ();\r
           if ( ! SummaryMode) {\r
             Status = ProcessHandles ( ExcludeMode);\r
             if (Status == EFI_ABORTED) {\r
index 8abc20f1683087478369683a31503405c861e624..1204d8ef5b09d3a6a2efd3d0b10e1f3d70ec55c1 100644 (file)
@@ -1,7 +1,7 @@
 ##  @file\r
 #  Display Performance Application, Module information file.\r
 #\r
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -56,7 +56,6 @@
   MemoryAllocationLib\r
   DebugLib\r
   UefiBootServicesTableLib\r
-  TimerLib\r
   PeCoffGetEntryPointLib\r
   PerformanceLib\r
   PrintLib\r
@@ -67,6 +66,9 @@
   DevicePathLib\r
   DxeServicesLib\r
 \r
+[Guids]\r
+  gPerformanceProtocolGuid                                ## CONSUMES ## SystemTable\r
+\r
 [Protocols]\r
   gEfiLoadedImageProtocolGuid                             ## CONSUMES\r
   gEfiHiiPackageListProtocolGuid                          ## CONSUMES\r
index 53c5fb201ae841cd83b72a120a250933f03b7074..1ab36ba7ede9d3ad5c40a47e7dde25f9b232bae1 100644 (file)
@@ -6,7 +6,7 @@
   Dp application.  In addition to global data, function declarations for\r
   DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -254,12 +254,10 @@ DumpRawTrace(
 /** \r
   Gather and print Major Phase metrics.\r
   \r
-  @param[in]    Ticker      The timer value for the END of Shell phase\r
-  \r
 **/\r
 VOID\r
 ProcessPhases(\r
-  IN UINT64 Ticker\r
+  VOID\r
   );\r
 \r
 \r
index eb5b3ddfffcd75fbc9fdc1413e43ca3081477932..15c2ef14d45d319f02e0b46018ffae8738cd135a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Measured Profiling reporting for the Dp utility.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -16,7 +16,6 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/PerformanceLib.h>\r
 #include <Library/PrintLib.h>\r
index daaa242e3d3b425ffc09100718ae209c8d8a904a..131d16bb6dce6484750737b2c42066c75aa41fc1 100644 (file)
@@ -1,12 +1,12 @@
 // *++\r
 //\r
-// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 // (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 // This program and the accompanying materials\r
 // are licensed and made available under the terms and conditions of the BSD License\r
 // which accompanies this distribution.  The full text of the license may be found at\r
 // http://opensource.org/licenses/bsd-license.php\r
-// \r
+//\r
 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 //\r
                                        #language fr-FR  "   -n COUNT\n"\r
 #string STR_DP_HELP_ID                 #language en-US  "   -i  display identifier\n"\r
                                        #language fr-FR  "   -i\n"\r
-#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN - Display pre-defined and custom cumulative data\r\n" \r
+#string STR_DP_HELP_CUM_DATA           #language en-US  "   -c TOKEN - Display pre-defined and custom cumulative data\r\n"\r
                                                         "              Pre-defined cumulative token are:\r\n"\r
                                                         "              1. LoadImage:\r\n"\r
                                                         "              2. StartImage:\r\n"\r
                                        #language fr-FR  "Localiser Toute erreur de Poignées - %r\n"\r
 #string STR_DP_ERROR_NAME              #language en-US  "Unknown Driver Name"\r
                                        #language fr-FR  "Unknown Driver Name"\r
+#string STR_PERF_PROPERTY_NOT_FOUND    #language en-US  "Performance property not found\n"\r
+                                       #language fr-FR  "Performance property not found\n"\r
 #string STR_DP_BUILD_REVISION          #language en-US  "\nDP Build Version:       %d.%d\n"\r
                                        #language fr-FR  "\nDP Construit la Version:         %d,%d\n"\r
 #string STR_DP_KHZ                     #language en-US  "System Performance Timer Frequency:   %,8d (KHz)\n"\r
 #string STR_DP_RAW_VARS2               #language en-US  "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"\r
                                        #language fr-FR  "%5d: %16LX %16LX %16LX  %31a  %31a %5d\n"\r
 #string STR_DP_RAW_HEADR2              #language en-US  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"\r
-                                       #language fr-FR  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"   \r
+                                       #language fr-FR  "\nIndex       Handle        Start Count       End Count                  Token                          Module                   ID\n"\r
 #string STR_DP_OPTION_UA               #language en-US  "-A"\r
                                        #language fr-FR  "-A"\r
 #string STR_DP_OPTION_LA               #language en-US  "-a"\r
index 6a62bba7efe0236bd0037ac34bb81f61bc12df70..9b4e0ed289ad19d9938eb07ad25e9c92ed672f36 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Trace reporting for the Dp utility.\r
 \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/PerformanceLib.h>\r
 #include <Library/PrintLib.h>\r
@@ -385,12 +384,10 @@ DumpRawTrace(
 /** \r
   Gather and print Major Phase metrics.\r
   \r
-  @param[in]    Ticker      The timer value for the END of Shell phase\r
-  \r
 **/\r
 VOID\r
 ProcessPhases(\r
-  IN UINT64            Ticker\r
+  VOID\r
   )\r
 {\r
   MEASUREMENT_RECORD        Measurement;\r
@@ -399,7 +396,6 @@ ProcessPhases(
   UINT64                    PeiTime;\r
   UINT64                    DxeTime;\r
   UINT64                    BdsTime;\r
-  UINT64                    ShellTime;\r
   UINT64                    ElapsedTime;\r
   UINT64                    Duration;\r
   UINT64                    Total;\r
@@ -412,7 +408,6 @@ ProcessPhases(
   PeiTime         = 0;\r
   DxeTime         = 0;\r
   BdsTime         = 0;\r
-  ShellTime       = 0;   \r
   //\r
   // Get Execution Phase Statistics\r
   //\r
@@ -433,9 +428,6 @@ ProcessPhases(
                           &Measurement.EndTimeStamp,\r
                           &Measurement.Identifier)) != 0)\r
   {\r
-    if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {\r
-      Measurement.EndTimeStamp = Ticker;\r
-    }\r
     if (Measurement.EndTimeStamp == 0) { // Skip "incomplete" records\r
       continue;\r
     }\r
@@ -453,8 +445,6 @@ ProcessPhases(
       DxeTime      = Duration;\r
     } else if (AsciiStrnCmp (Measurement.Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0) {\r
       BdsTime      = Duration;\r
-    } else if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {\r
-      ShellTime    = Duration;\r
     }\r
   }\r
 \r
@@ -509,17 +499,6 @@ ProcessPhases(
     PrintToken (STRING_TOKEN (STR_DP_PHASE_BDSTO), ALit_BdsTO, ElapsedTime);\r
   }\r
 \r
-  // print SHELL phase duration time\r
-  //\r
-  if (ShellTime > 0) {\r
-    ElapsedTime = DivU64x32 (\r
-                    ShellTime,\r
-                    (UINT32)TimerInfo.Frequency\r
-                    );\r
-    Total += ElapsedTime;\r
-    PrintToken (STRING_TOKEN (STR_DP_PHASE_DURATION), ALit_SHELL, ElapsedTime);\r
-  }\r
-\r
   PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);\r
 }\r
 \r
index 13d38979d3f696dec79e1d984569cac8c3edcacb..d5840e8d6f833b39da257720f2f96918ea41829b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Utility functions used by the Dp application.\r
 \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -17,7 +17,6 @@
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/PrintLib.h>\r
 #include <Library/HiiLib.h>\r
index 68de0fbc9ece3910f47d0d53ef1ff2c49d519567..c1cddfb9ffb25f7cdbe6f68e24ffc6b6512fe1a9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definitions of ASCII string literals used by DP.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -16,7 +16,6 @@
 CHAR8 const ALit_TimerLibError[] = "Timer library instance error!\n";\r
 CHAR8 const ALit_SEC[]    = SEC_TOK;\r
 CHAR8 const ALit_DXE[]    = DXE_TOK;\r
-CHAR8 const ALit_SHELL[]  = SHELL_TOK;\r
 CHAR8 const ALit_PEI[]    = PEI_TOK;\r
 CHAR8 const ALit_BDS[]    = BDS_TOK;\r
 CHAR8 const ALit_BdsTO[]  = "BdsTimeOut";\r