From 5b491514ecfefc9a4b11cac789ec3a8e5b8f13f2 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Tue, 28 Jun 2011 11:41:34 +0000 Subject: [PATCH] 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 --- ArmPkg/Library/BdsLib/BdsHelper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Library/BdsLib/BdsHelper.c b/ArmPkg/Library/BdsLib/BdsHelper.c index fa9483ea81..a006e90db4 100644 --- a/ArmPkg/Library/BdsLib/BdsHelper.c +++ b/ArmPkg/Library/BdsLib/BdsHelper.c @@ -259,8 +259,14 @@ PrintPerformance ( UINTN Index; CHAR8 Buffer[100]; UINTN CharCount; + BOOLEAN CountUp; - TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL); + TicksPerSecond = GetPerformanceCounterProperties (&Start, &Stop); + if (Start < Stop) { + CountUp = TRUE; + } else { + CountUp = FALSE; + } TimeStamp = 0; Key = 0; @@ -269,7 +275,7 @@ PrintPerformance ( if (Key != 0) { for (Index = 0; mTokenList[Index] != NULL; Index++) { if (AsciiStriCmp (mTokenList[Index], Token) == 0) { - Delta = Start - Stop; + Delta = CountUp?(Stop - Start):(Start - Stop); TimeStamp += Delta; Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL); CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"%6a %6ld ms\n", Token, Milliseconds);