summaryrefslogtreecommitdiffstats
path: root/PerformancePkg
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-01-20 11:18:14 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-01-20 11:18:14 +0000
commit0d70a7090f008b1d8d5f1592aad3c82e26bf1acf (patch)
tree9eb00638d829d2a75d876aa5c7f83da2361297bd /PerformancePkg
parent2e7120cd37935adea810d1cdc4c4aaad500c9222 (diff)
downloadedk2-0d70a7090f008b1d8d5f1592aad3c82e26bf1acf.tar.gz
edk2-0d70a7090f008b1d8d5f1592aad3c82e26bf1acf.tar.bz2
edk2-0d70a7090f008b1d8d5f1592aad3c82e26bf1acf.zip
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
Diffstat (limited to 'PerformancePkg')
-rw-r--r--PerformancePkg/Dp_App/DpTrace.c28
1 files 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
+ );
+ }
}
}