]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c
ShellPkg/Dp: Updated to dump perf log based on FPDT table
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / DpUtilities.c
index b98ec4b5bd8764b61dc202acfbc5b6caf59e5ec4..39f71a044c34bf3f59592cf9a31f429299311c32 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Utility functions used by the Dp application.\r
 \r
-  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.\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
@@ -71,22 +71,8 @@ GetDuration (
     return 0;\r
   }\r
 \r
-  // PERF_START macros are called with a value of 1 to indicate\r
-  // the beginning of time.  So, adjust the start ticker value\r
-  // to the real beginning of time.\r
-  // Assumes no wraparound.  Even then, there is a very low probability\r
-  // of having a valid StartTicker value of 1.\r
-  if (Measurement->StartTimeStamp == 1) {\r
-    Measurement->StartTimeStamp = TimerInfo.StartCount;\r
-  }\r
-  if (TimerInfo.CountUp) {\r
-    Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;\r
-    Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);\r
-  }\r
-  else {\r
-    Duration = Measurement->StartTimeStamp - Measurement->EndTimeStamp;\r
-    Error = (BOOLEAN)(Duration > Measurement->StartTimeStamp);\r
-  }\r
+  Duration = Measurement->EndTimeStamp - Measurement->StartTimeStamp;\r
+  Error = (BOOLEAN)(Duration > Measurement->EndTimeStamp);\r
 \r
   if (Error) {\r
     DEBUG ((EFI_D_ERROR, ALit_TimerLibError));\r
@@ -113,11 +99,11 @@ IsPhase(
 {\r
   BOOLEAN   RetVal;\r
 \r
-  RetVal = (BOOLEAN)( ( *Measurement->Module == '\0')                               &&\r
-            ((AsciiStrnCmp (Measurement->Token, ALit_SEC, PERF_TOKEN_LENGTH) == 0)    ||\r
-             (AsciiStrnCmp (Measurement->Token, ALit_PEI, PERF_TOKEN_LENGTH) == 0)    ||\r
-             (AsciiStrnCmp (Measurement->Token, ALit_DXE, PERF_TOKEN_LENGTH) == 0)    ||\r
-             (AsciiStrnCmp (Measurement->Token, ALit_BDS, PERF_TOKEN_LENGTH) == 0))\r
+  RetVal = (BOOLEAN)(\r
+            ((AsciiStrCmp (Measurement->Token, ALit_SEC) == 0)    ||\r
+             (AsciiStrCmp (Measurement->Token, ALit_PEI) == 0)    ||\r
+             (AsciiStrCmp (Measurement->Token, ALit_DXE) == 0)    ||\r
+             (AsciiStrCmp (Measurement->Token, ALit_BDS) == 0))\r
             );\r
   return RetVal;\r
 }\r
@@ -378,10 +364,7 @@ DurationInMicroSeconds (
   IN UINT64 Duration\r
   )\r
 {\r
-  UINT64 Temp;\r
-\r
-  Temp = MultU64x32 (Duration, 1000);\r
-  return DivU64x32 (Temp, TimerInfo.Frequency);\r
+  return DivU64x32 (Duration, 1000);\r
 }\r
 \r
 /** \r
@@ -405,7 +388,7 @@ GetCumulativeItem(
   INTN    Index;\r
 \r
   for( Index = 0; Index < (INTN)NumCum; ++Index) {\r
-    if (AsciiStrnCmp (Measurement->Token, CumData[Index].Name, PERF_TOKEN_LENGTH) == 0) {\r
+    if (AsciiStrCmp (Measurement->Token, CumData[Index].Name) == 0) {\r
       return Index;  // Exit, we found a match\r
     }\r
   }\r