ArmPkg/BdsLib: Check if the performance timer is counting down or up in PrintPerformance()

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11914 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2011-06-28 11:41:34 +00:00
parent 8ca6180f21
commit 5b491514ec
1 changed files with 8 additions and 2 deletions

View File

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