mirror of https://github.com/acidanthera/audk.git
PerformancePkg/Dp_App: Support dumping cumulative data
Add a new option -c to dump cumulative data. For example: shell> dp -c ==[ Cumulative ]======== (Times in microsec.) Cumulative Average Shortest Longest Name Count Duration Duration Duration Duration LoadImage: 200 1000000 7000 0 100000 StartImage: 200 20000000 90000 0 7000000 DB:Start: 200 20000000 100000 0 9000000 DB:Support: 200000 100000 0 0 7000 shell> dp -c DXE ==[ Cumulative ]======== (Times in microsec.) Cumulative Average Shortest Longest Name Count Duration Duration Duration Duration LoadImage: 200 1000000 7000 0 100000 StartImage: 200 20000000 90000 0 7000000 DB:Start: 200 20000000 100000 0 9000000 DB:Support: 200000 100000 0 0 7000 DXE 1 30000000 30000000 0 30000000 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18762 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
62cae3513b
commit
d28f77df0f
|
@ -14,6 +14,7 @@
|
||||||
timer information to calculate elapsed time for each measurement.
|
timer information to calculate elapsed time for each measurement.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -81,6 +82,7 @@ PARAM_ITEM_LIST ParamList[] = {
|
||||||
#endif
|
#endif
|
||||||
{STRING_TOKEN (STR_DP_OPTION_LX), TypeFlag}, // -x eXclude Cumulative Items
|
{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_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_LN), TypeValue}, // -n # Number of records to display for A and R
|
||||||
{STRING_TOKEN (STR_DP_OPTION_LT), TypeValue} // -t # Threshold of interest
|
{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_THRESHOLD));
|
||||||
PrintToken (STRING_TOKEN (STR_DP_HELP_COUNT));
|
PrintToken (STRING_TOKEN (STR_DP_HELP_COUNT));
|
||||||
PrintToken (STRING_TOKEN (STR_DP_HELP_ID));
|
PrintToken (STRING_TOKEN (STR_DP_HELP_ID));
|
||||||
|
PrintToken (STRING_TOKEN (STR_DP_HELP_CUM_DATA));
|
||||||
PrintToken (STRING_TOKEN (STR_DP_HELP_HELP));
|
PrintToken (STRING_TOKEN (STR_DP_HELP_HELP));
|
||||||
Print(L"\n");
|
Print(L"\n");
|
||||||
}
|
}
|
||||||
|
@ -168,7 +171,26 @@ DumpStatistics( void )
|
||||||
FreePool (StringPtrUnknown);
|
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.
|
Dump performance data.
|
||||||
|
|
||||||
@param[in] ImageHandle The image handle.
|
@param[in] ImageHandle The image handle.
|
||||||
|
@ -203,6 +225,9 @@ InitializeDp (
|
||||||
BOOLEAN TraceMode;
|
BOOLEAN TraceMode;
|
||||||
BOOLEAN ProfileMode;
|
BOOLEAN ProfileMode;
|
||||||
BOOLEAN ExcludeMode;
|
BOOLEAN ExcludeMode;
|
||||||
|
BOOLEAN CumulativeMode;
|
||||||
|
CONST CHAR16 *CustomCumulativeToken;
|
||||||
|
PERF_CUM_DATA *CustomCumulativeData;
|
||||||
|
|
||||||
EFI_STRING StringDpOptionQh;
|
EFI_STRING StringDpOptionQh;
|
||||||
EFI_STRING StringDpOptionLh;
|
EFI_STRING StringDpOptionLh;
|
||||||
|
@ -218,6 +243,7 @@ InitializeDp (
|
||||||
EFI_STRING StringDpOptionLn;
|
EFI_STRING StringDpOptionLn;
|
||||||
EFI_STRING StringDpOptionLt;
|
EFI_STRING StringDpOptionLt;
|
||||||
EFI_STRING StringDpOptionLi;
|
EFI_STRING StringDpOptionLi;
|
||||||
|
EFI_STRING StringDpOptionLc;
|
||||||
|
|
||||||
SummaryMode = FALSE;
|
SummaryMode = FALSE;
|
||||||
VerboseMode = FALSE;
|
VerboseMode = FALSE;
|
||||||
|
@ -226,6 +252,8 @@ InitializeDp (
|
||||||
TraceMode = FALSE;
|
TraceMode = FALSE;
|
||||||
ProfileMode = FALSE;
|
ProfileMode = FALSE;
|
||||||
ExcludeMode = FALSE;
|
ExcludeMode = FALSE;
|
||||||
|
CumulativeMode = FALSE;
|
||||||
|
CustomCumulativeData = NULL;
|
||||||
|
|
||||||
StringDpOptionQh = NULL;
|
StringDpOptionQh = NULL;
|
||||||
StringDpOptionLh = NULL;
|
StringDpOptionLh = NULL;
|
||||||
|
@ -241,6 +269,7 @@ InitializeDp (
|
||||||
StringDpOptionLn = NULL;
|
StringDpOptionLn = NULL;
|
||||||
StringDpOptionLt = NULL;
|
StringDpOptionLt = NULL;
|
||||||
StringDpOptionLi = NULL;
|
StringDpOptionLi = NULL;
|
||||||
|
StringDpOptionLc = NULL;
|
||||||
StringPtr = NULL;
|
StringPtr = NULL;
|
||||||
|
|
||||||
// Get DP's entry time as soon as possible.
|
// Get DP's entry time as soon as possible.
|
||||||
|
@ -289,6 +318,7 @@ InitializeDp (
|
||||||
StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);
|
StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);
|
||||||
StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);
|
StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);
|
||||||
StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);
|
StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);
|
||||||
|
StringDpOptionLc = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LC), NULL);
|
||||||
|
|
||||||
// Boolean Options
|
// Boolean Options
|
||||||
//
|
//
|
||||||
|
@ -303,6 +333,7 @@ InitializeDp (
|
||||||
#endif // PROFILING_IMPLEMENTED
|
#endif // PROFILING_IMPLEMENTED
|
||||||
ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
|
ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
|
||||||
mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);
|
mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);
|
||||||
|
CumulativeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLc);
|
||||||
|
|
||||||
// Options with Values
|
// Options with Values
|
||||||
CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
|
CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
|
||||||
|
@ -331,6 +362,20 @@ InitializeDp (
|
||||||
#endif // PROFILING_IMPLEMENTED
|
#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 ****
|
**** Timer specific processing ****
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -392,8 +437,10 @@ InitializeDp (
|
||||||
**** !T && P := (2) Only Profile records are displayed
|
**** !T && P := (2) Only Profile records are displayed
|
||||||
**** T && P := (3) Same as Default, both are displayed
|
**** T && P := (3) Same as Default, both are displayed
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
GatherStatistics();
|
GatherStatistics (CustomCumulativeData);
|
||||||
if (AllMode) {
|
if (CumulativeMode) {
|
||||||
|
ProcessCumulative (CustomCumulativeData);
|
||||||
|
} else if (AllMode) {
|
||||||
if (TraceMode) {
|
if (TraceMode) {
|
||||||
DumpAllTrace( Number2Display, ExcludeMode);
|
DumpAllTrace( Number2Display, ExcludeMode);
|
||||||
}
|
}
|
||||||
|
@ -418,7 +465,7 @@ InitializeDp (
|
||||||
if ( ! EFI_ERROR( Status)) {
|
if ( ! EFI_ERROR( Status)) {
|
||||||
ProcessPeims ( );
|
ProcessPeims ( );
|
||||||
ProcessGlobal ( );
|
ProcessGlobal ( );
|
||||||
ProcessCumulative ();
|
ProcessCumulative (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,6 +479,7 @@ InitializeDp (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Free the memory allocate from HiiGetString
|
// Free the memory allocate from HiiGetString
|
||||||
//
|
//
|
||||||
ListIndex = 0;
|
ListIndex = 0;
|
||||||
|
@ -455,9 +503,15 @@ InitializeDp (
|
||||||
SafeFreePool (StringDpOptionLn);
|
SafeFreePool (StringDpOptionLn);
|
||||||
SafeFreePool (StringDpOptionLt);
|
SafeFreePool (StringDpOptionLt);
|
||||||
SafeFreePool (StringDpOptionLi);
|
SafeFreePool (StringDpOptionLi);
|
||||||
|
SafeFreePool (StringDpOptionLc);
|
||||||
SafeFreePool (StringPtr);
|
SafeFreePool (StringPtr);
|
||||||
SafeFreePool (mPrintTokenBuffer);
|
SafeFreePool (mPrintTokenBuffer);
|
||||||
|
|
||||||
|
if (CustomCumulativeData != NULL) {
|
||||||
|
SafeFreePool (CustomCumulativeData->Name);
|
||||||
|
}
|
||||||
|
SafeFreePool (CustomCumulativeData);
|
||||||
|
|
||||||
HiiRemovePackages (gHiiHandle);
|
HiiRemovePackages (gHiiHandle);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
|
DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
|
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -188,10 +189,13 @@ GetCumulativeItem(
|
||||||
|
|
||||||
@post The SummaryData and CumData structures contain statistics for the
|
@post The SummaryData and CumData structures contain statistics for the
|
||||||
current performance logs.
|
current performance logs.
|
||||||
|
|
||||||
|
@param[in, out] CustomCumulativeData The pointer to the custom cumulative data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
GatherStatistics(
|
GatherStatistics(
|
||||||
VOID
|
IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -299,11 +303,13 @@ ProcessGlobal(
|
||||||
For each record with a Token listed in the CumData array:<BR>
|
For each record with a Token listed in the CumData array:<BR>
|
||||||
- Update the instance count and the total, minimum, and maximum durations.
|
- Update the instance count and the total, minimum, and maximum durations.
|
||||||
Finally, print the gathered cumulative statistics.
|
Finally, print the gathered cumulative statistics.
|
||||||
|
|
||||||
|
@param[in] CustomCumulativeData The pointer to the custom cumulative data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ProcessCumulative(
|
ProcessCumulative(
|
||||||
VOID
|
IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Binary file not shown.
|
@ -2,6 +2,7 @@
|
||||||
Trace reporting for the Dp utility.
|
Trace reporting for the Dp utility.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -42,11 +43,14 @@
|
||||||
|
|
||||||
@post The SummaryData and CumData structures contain statistics for the
|
@post The SummaryData and CumData structures contain statistics for the
|
||||||
current performance logs.
|
current performance logs.
|
||||||
|
|
||||||
|
@param[in, out] CustomCumulativeData A pointer to the cumtom cumulative data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
GatherStatistics(
|
GatherStatistics(
|
||||||
VOID
|
IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MEASUREMENT_RECORD Measurement;
|
MEASUREMENT_RECORD Measurement;
|
||||||
UINT64 Duration;
|
UINT64 Duration;
|
||||||
|
@ -98,6 +102,20 @@ GatherStatistics(
|
||||||
CumData[TIndex].MaxDur = Duration;
|
CumData[TIndex].MaxDur = Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Collect the data for custom cumulative data.
|
||||||
|
//
|
||||||
|
if ((CustomCumulativeData != NULL) && (AsciiStrCmp (Measurement.Token, CustomCumulativeData->Name) == 0)) {
|
||||||
|
CustomCumulativeData->Duration += Duration;
|
||||||
|
CustomCumulativeData->Count++;
|
||||||
|
if (Duration < CustomCumulativeData->MinDur) {
|
||||||
|
CustomCumulativeData->MinDur = Duration;
|
||||||
|
}
|
||||||
|
if (Duration > CustomCumulativeData->MaxDur) {
|
||||||
|
CustomCumulativeData->MaxDur = Duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,12 +803,14 @@ ProcessGlobal(
|
||||||
For each record with a Token listed in the CumData array:<BR>
|
For each record with a Token listed in the CumData array:<BR>
|
||||||
- Update the instance count and the total, minimum, and maximum durations.
|
- Update the instance count and the total, minimum, and maximum durations.
|
||||||
Finally, print the gathered cumulative statistics.
|
Finally, print the gathered cumulative statistics.
|
||||||
|
|
||||||
|
@param[in] CustomCumulativeData A pointer to the cumtom cumulative data.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ProcessCumulative(
|
ProcessCumulative(
|
||||||
VOID
|
IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 AvgDur; // the computed average duration
|
UINT64 AvgDur; // the computed average duration
|
||||||
UINT64 Dur;
|
UINT64 Dur;
|
||||||
|
@ -829,4 +849,30 @@ ProcessCumulative(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print the custom cumulative data.
|
||||||
|
//
|
||||||
|
if (CustomCumulativeData != NULL) {
|
||||||
|
if (CustomCumulativeData->Count != 0) {
|
||||||
|
AvgDur = DivU64x32 (CustomCumulativeData->Duration, CustomCumulativeData->Count);
|
||||||
|
AvgDur = DurationInMicroSeconds (AvgDur);
|
||||||
|
Dur = DurationInMicroSeconds (CustomCumulativeData->Duration);
|
||||||
|
MaxDur = DurationInMicroSeconds (CustomCumulativeData->MaxDur);
|
||||||
|
MinDur = DurationInMicroSeconds (CustomCumulativeData->MinDur);
|
||||||
|
} else {
|
||||||
|
AvgDur = 0;
|
||||||
|
Dur = 0;
|
||||||
|
MaxDur = 0;
|
||||||
|
MinDur = 0;
|
||||||
|
}
|
||||||
|
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
|
||||||
|
CustomCumulativeData->Name,
|
||||||
|
CustomCumulativeData->Count,
|
||||||
|
Dur,
|
||||||
|
AvgDur,
|
||||||
|
MinDur,
|
||||||
|
MaxDur
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue