mirror of https://github.com/acidanthera/audk.git
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:
parent
8ca6180f21
commit
5b491514ec
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue