mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
ArmPlatformPkg/EblCmdLib: Fixed 'performance' command
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
This commit is contained in:
parent
ba8bd8ce71
commit
68978a52ae
@ -223,8 +223,14 @@ EblPerformance (
|
|||||||
UINT64 Start, Stop, TimeStamp;
|
UINT64 Start, Stop, TimeStamp;
|
||||||
UINT64 Delta, TicksPerSecond, Milliseconds, Microseconds;
|
UINT64 Delta, TicksPerSecond, Milliseconds, Microseconds;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
BOOLEAN CountUp;
|
||||||
|
|
||||||
TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);
|
TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop);
|
||||||
|
if (Start < Stop) {
|
||||||
|
CountUp = TRUE;
|
||||||
|
} else {
|
||||||
|
CountUp = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Key = 0;
|
Key = 0;
|
||||||
do {
|
do {
|
||||||
@ -235,7 +241,7 @@ EblPerformance (
|
|||||||
// The entry for EBL is still running so the stop time will be zero. Skip it
|
// The entry for EBL is still running so the stop time will be zero. Skip it
|
||||||
AsciiPrint (" running %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
|
AsciiPrint (" running %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
|
||||||
} else {
|
} else {
|
||||||
Delta = Start - Stop;
|
Delta = CountUp?(Stop - Start):(Start - Stop);
|
||||||
Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);
|
Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);
|
||||||
AsciiPrint ("%10ld us %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
|
AsciiPrint ("%10ld us %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));
|
||||||
}
|
}
|
||||||
@ -252,7 +258,7 @@ EblPerformance (
|
|||||||
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);
|
||||||
AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);
|
AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user