]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/EblCmdLib: Fixed 'performance' command
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 26 Sep 2012 20:24:10 +0000 (20:24 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 26 Sep 2012 20:24:10 +0000 (20:24 +0000)
Added support for performance counter that counts up or down

Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13747 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c

index f9e4b40a8e0bedb04e6d7b522b9ae104ebb5a9f3..4c298a61cf6f6406df222bdd79f2921df279528a 100644 (file)
@@ -223,8 +223,14 @@ EblPerformance (
   UINT64      Start, Stop, TimeStamp;\r
   UINT64      Delta, TicksPerSecond, Milliseconds, Microseconds;\r
   UINTN       Index;\r
+  BOOLEAN     CountUp;\r
 \r
-  TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);\r
+  TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop);\r
+  if (Start < Stop) {\r
+    CountUp = TRUE;\r
+  } else {\r
+    CountUp = FALSE;\r
+  }\r
 \r
   Key       = 0;\r
   do {\r
@@ -235,7 +241,7 @@ EblPerformance (
           // The entry for EBL is still running so the stop time will be zero. Skip it\r
           AsciiPrint ("   running     %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
         } else {\r
-          Delta = Start - Stop;\r
+          Delta =  CountUp?(Stop - Start):(Start - Stop);\r
           Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);\r
           AsciiPrint ("%10ld us  %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
         }\r
@@ -252,7 +258,7 @@ EblPerformance (
     if (Key != 0) {\r
       for (Index = 0; mTokenList[Index] != NULL; Index++) {\r
         if (AsciiStriCmp (mTokenList[Index], Token) == 0) {\r
-          Delta = Start - Stop;\r
+          Delta =  CountUp?(Stop - Start):(Start - Stop);\r
           TimeStamp += Delta;\r
           Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);\r
           AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);\r