summaryrefslogtreecommitdiffstats
path: root/PerformancePkg/Dp_App/Dp.c
diff options
context:
space:
mode:
Diffstat (limited to 'PerformancePkg/Dp_App/Dp.c')
-rw-r--r--PerformancePkg/Dp_App/Dp.c62
1 files changed, 58 insertions, 4 deletions
diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
index 57144a8fb8..0f61b9daaa 100644
--- a/PerformancePkg/Dp_App/Dp.c
+++ b/PerformancePkg/Dp_App/Dp.c
@@ -14,6 +14,7 @@
timer information to calculate elapsed time for each measurement.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ (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
@@ -81,6 +82,7 @@ PARAM_ITEM_LIST ParamList[] = {
#endif
{STRING_TOKEN (STR_DP_OPTION_LX), TypeFlag}, // -x eXclude Cumulative Items
{STRING_TOKEN (STR_DP_OPTION_LI), TypeFlag}, // -i Display Identifier
+ {STRING_TOKEN (STR_DP_OPTION_LC), TypeValue}, // -c Display cumulative data.
{STRING_TOKEN (STR_DP_OPTION_LN), TypeValue}, // -n # Number of records to display for A and R
{STRING_TOKEN (STR_DP_OPTION_LT), TypeValue} // -t # Threshold of interest
};
@@ -138,6 +140,7 @@ ShowHelp( void )
PrintToken (STRING_TOKEN (STR_DP_HELP_THRESHOLD));
PrintToken (STRING_TOKEN (STR_DP_HELP_COUNT));
PrintToken (STRING_TOKEN (STR_DP_HELP_ID));
+ PrintToken (STRING_TOKEN (STR_DP_HELP_CUM_DATA));
PrintToken (STRING_TOKEN (STR_DP_HELP_HELP));
Print(L"\n");
}
@@ -168,7 +171,26 @@ DumpStatistics( void )
FreePool (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.
@@ -203,6 +225,9 @@ InitializeDp (
BOOLEAN TraceMode;
BOOLEAN ProfileMode;
BOOLEAN ExcludeMode;
+ BOOLEAN CumulativeMode;
+ CONST CHAR16 *CustomCumulativeToken;
+ PERF_CUM_DATA *CustomCumulativeData;
EFI_STRING StringDpOptionQh;
EFI_STRING StringDpOptionLh;
@@ -218,6 +243,7 @@ InitializeDp (
EFI_STRING StringDpOptionLn;
EFI_STRING StringDpOptionLt;
EFI_STRING StringDpOptionLi;
+ EFI_STRING StringDpOptionLc;
SummaryMode = FALSE;
VerboseMode = FALSE;
@@ -226,6 +252,8 @@ InitializeDp (
TraceMode = FALSE;
ProfileMode = FALSE;
ExcludeMode = FALSE;
+ CumulativeMode = FALSE;
+ CustomCumulativeData = NULL;
StringDpOptionQh = NULL;
StringDpOptionLh = NULL;
@@ -241,6 +269,7 @@ InitializeDp (
StringDpOptionLn = NULL;
StringDpOptionLt = NULL;
StringDpOptionLi = NULL;
+ StringDpOptionLc = NULL;
StringPtr = NULL;
// Get DP's entry time as soon as possible.
@@ -289,6 +318,7 @@ InitializeDp (
StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);
StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);
StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);
+ StringDpOptionLc = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LC), NULL);
// Boolean Options
//
@@ -303,6 +333,7 @@ InitializeDp (
#endif // PROFILING_IMPLEMENTED
ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);
+ CumulativeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLc);
// Options with Values
CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
@@ -331,6 +362,20 @@ InitializeDp (
#endif // PROFILING_IMPLEMENTED
}
+ //
+ // Init the custom cumulative data.
+ //
+ CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, StringDpOptionLc);
+ if (CustomCumulativeToken != NULL) {
+ CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));
+ CustomCumulativeData->MinDur = 0;
+ CustomCumulativeData->MaxDur = 0;
+ CustomCumulativeData->Count = 0;
+ CustomCumulativeData->Duration = 0;
+ CustomCumulativeData->Name = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1);
+ UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name);
+ }
+
/****************************************************************************
**** Timer specific processing ****
****************************************************************************/
@@ -392,8 +437,10 @@ InitializeDp (
**** !T && P := (2) Only Profile records are displayed
**** T && P := (3) Same as Default, both are displayed
****************************************************************************/
- GatherStatistics();
- if (AllMode) {
+ GatherStatistics (CustomCumulativeData);
+ if (CumulativeMode) {
+ ProcessCumulative (CustomCumulativeData);
+ } else if (AllMode) {
if (TraceMode) {
DumpAllTrace( Number2Display, ExcludeMode);
}
@@ -418,7 +465,7 @@ InitializeDp (
if ( ! EFI_ERROR( Status)) {
ProcessPeims ( );
ProcessGlobal ( );
- ProcessCumulative ();
+ ProcessCumulative (NULL);
}
}
}
@@ -432,6 +479,7 @@ InitializeDp (
}
}
+ //
// Free the memory allocate from HiiGetString
//
ListIndex = 0;
@@ -455,9 +503,15 @@ InitializeDp (
SafeFreePool (StringDpOptionLn);
SafeFreePool (StringDpOptionLt);
SafeFreePool (StringDpOptionLi);
+ SafeFreePool (StringDpOptionLc);
SafeFreePool (StringPtr);
SafeFreePool (mPrintTokenBuffer);
+ if (CustomCumulativeData != NULL) {
+ SafeFreePool (CustomCumulativeData->Name);
+ }
+ SafeFreePool (CustomCumulativeData);
+
HiiRemovePackages (gHiiHandle);
return Status;
}