summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorCinnamon Shia <cinnamon.shia@hpe.com>2015-11-05 01:03:14 +0000
committerlzeng14 <lzeng14@Edk2>2015-11-05 01:03:14 +0000
commit303ec9bc9f3329e2ec20ef480e071777cc5b8514 (patch)
treeb934ec1e6a3e3c898703586ceae9f4751c14272a /ShellPkg
parentc2e5e70a854552f91ae29e4b85dfc213dbaaca6d (diff)
downloadedk2-platforms-303ec9bc9f3329e2ec20ef480e071777cc5b8514.tar.xz
ShellPkg/UefiDpLib: Fix a DP cumulative data issue
The value of PERF_CUM_DATA.Count and PERF_CUM_DATA.Duration field keep cumulating on every execution of dp. Initialize the CumData at dp's entry point. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18727 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiDpLib/Dp.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c
index 82701723c8..62a4e7b577 100644
--- a/ShellPkg/Library/UefiDpLib/Dp.c
+++ b/ShellPkg/Library/UefiDpLib/Dp.c
@@ -14,6 +14,7 @@
timer information to calculate elapsed time for each measurement.
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+ (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -110,7 +111,26 @@ DumpStatistics( void )
SHELL_FREE_NON_NULL (StringPtrUnknown);
}
-/**
+/**
+ Initialize the cumulative data.
+
+**/
+VOID
+InitCumulativeData (
+ VOID
+ )
+{
+ UINTN Index;
+
+ for (Index = 0; Index < NumCum; ++Index) {
+ CumData[Index].Count = 0;
+ CumData[Index].MinDur = PERF_MAXDUR;
+ CumData[Index].MaxDur = 0;
+ CumData[Index].Duration = 0;
+ }
+}
+
+/**
Dump performance data.
@param[in] ImageHandle The image handle.
@@ -219,6 +239,11 @@ ShellCommandRunDp (
}
//
+ // Initialize the pre-defined cumulative data.
+ //
+ InitCumulativeData ();
+
+ //
// Timer specific processing
//
// Get the Performance counter characteristics: