]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Check if the performance timer is counting down or up in PrintPerforma...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Jun 2011 11:41:34 +0000 (11:41 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 28 Jun 2011 11:41:34 +0000 (11:41 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11914 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/BdsLib/BdsHelper.c

index fa9483ea816d0ad66fb99c85036a1f69230a3d16..a006e90db40053c3d7c18a9ebde2589bf3a1abde 100644 (file)
@@ -259,8 +259,14 @@ PrintPerformance (
   UINTN       Index;
   CHAR8       Buffer[100];
   UINTN       CharCount;
+  BOOLEAN     CountUp;
 
-  TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);
+  TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop);
+  if (Start < Stop) {
+    CountUp = TRUE;
+  } else {
+    CountUp = FALSE;
+  }
 
   TimeStamp = 0;
   Key       = 0;
@@ -269,7 +275,7 @@ PrintPerformance (
     if (Key != 0) {
       for (Index = 0; mTokenList[Index] != NULL; Index++) {
         if (AsciiStriCmp (mTokenList[Index], Token) == 0) {
-          Delta = Start - Stop;
+          Delta = CountUp?(Stop - Start):(Start - Stop);
           TimeStamp += Delta;
           Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);
           CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"%6a %6ld ms\n", Token, Milliseconds);