From e52ab636c6e22788d5a968da3198498f20487aaa Mon Sep 17 00:00:00 2001 From: Cinnamon Shia Date: Fri, 18 Dec 2015 07:33:22 +0000 Subject: 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. (Sync patch r18727 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia Reviewed-by: Star Zeng Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19400 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiDpLib/Dp.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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
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. @@ -218,6 +238,11 @@ ShellCommandRunDp ( #endif // PROFILING_IMPLEMENTED } + // + // Initialize the pre-defined cumulative data. + // + InitCumulativeData (); + // // Timer specific processing // -- cgit v1.2.3