]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PerformancePkg/Dp_App/Dp.c
PerformancePkg Dp_App: Remove TimerLib dependency
[mirror_edk2.git] / PerformancePkg / Dp_App / Dp.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