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
// 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
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