From 0d70a7090f008b1d8d5f1592aad3c82e26bf1acf Mon Sep 17 00:00:00 2001 From: lzeng14 Date: Thu, 20 Jan 2011 11:18:14 +0000 Subject: [PATCH] ProcessCumulative() function always calculates the average performance by dividing the count of performance record. When the count is zero, it will report exception, so it needs to be enhanced to check the dividend. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11260 6f19259b-4bc3-4df7-8a09-765794883524 --- PerformancePkg/Dp_App/DpTrace.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c index b70e3a2208..b60d7c98c0 100644 --- a/PerformancePkg/Dp_App/DpTrace.c +++ b/PerformancePkg/Dp_App/DpTrace.c @@ -723,19 +723,21 @@ ProcessCumulative( PrintToken (STRING_TOKEN (STR_DP_DASHES)); for ( TIndex = 0; TIndex < NumCum; ++TIndex) { - AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count); - AvgDur = DurationInMicroSeconds(AvgDur); - Dur = DurationInMicroSeconds(CumData[TIndex].Duration); - MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur); - MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur); + if (CumData[TIndex].Count != 0) { + AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count); + AvgDur = DurationInMicroSeconds(AvgDur); + Dur = DurationInMicroSeconds(CumData[TIndex].Duration); + MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur); + MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur); - PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS), - CumData[TIndex].Name, - CumData[TIndex].Count, - Dur, - AvgDur, - MinDur, - MaxDur - ); + PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS), + CumData[TIndex].Name, + CumData[TIndex].Count, + Dur, + AvgDur, + MinDur, + MaxDur + ); + } } }