Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
Hi Star, Yes. The patch for PerformancePkg\Dp_App was submitted. Thanks, Cinnamon Shia -Original Message- From: Zeng, Star [mailto:star.z...@intel.com] Sent: Friday, November 6, 2015 5:49 PM To: Shia, Cinnamon; edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data On 2015/11/3 21:09, Shia, Cinnamon wrote: > Stat, > > Thanks for your feedback and review. > Will submit the v2 patch for addressing your comments. > And submit another patch for PerformancePkg\Dp_App Shia, Since the changes in UefiDpLib has been committed. Will you submit patch for PerformancePkg\Dp_App? Thanks, Star > > Thanks, > Cinnamon Shia > > -Original Message- > From: Zeng, Star [mailto:star.z...@intel.com] > Sent: Tuesday, November 3, 2015 11:16 AM > To: Shia, Cinnamon; edk2-devel@lists.01.org > Subject: Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping > cumulative data > > On 2015/11/2 17:11, Cinnamon Shia wrote: >> Add a new option -c to dump cumulative data. >> For example: >> shell> dp -c >> ==[ Cumulative ] >> (Times in microsec.) Cumulative Average ShortestLongest >> Name CountDurationDurationDurationDuration >> LoadImage: 200 1007000 0 10 >> StartImage:2002000 9 0 700 >> DB:Start:2002000 10 0 900 >> DB:Support: 20 10 0 07000 >> >> shell> dp -c DXE >> ==[ Cumulative ] >> (Times in microsec.) Cumulative Average ShortestLongest >> Name CountDurationDurationDurationDuration >> LoadImage: 200 1007000 0 10 >> StartImage:2002000 9 0 700 >> DB:Start:2002000 10 0 900 >> DB:Support: 20 10 0 07000 >> DXE 130003000 03000 >> >> Signed-off-by: Cinnamon Shia >> --- >>ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- >>ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- >>ShellPkg/Library/UefiDpLib/DpTrace.c | 55 >> --- >>ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes >>4 files changed, 87 insertions(+), 10 deletions(-) > > Could the "HP_ISS" be removed from the patch? > Could you help sync the change to PerformancePkg\Dp_App? > > Thanks, > Star > >> >> diff --git a/ShellPkg/Library/UefiDpLib/Dp.c >> b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 >> --- a/ShellPkg/Library/UefiDpLib/Dp.c >> +++ b/ShellPkg/Library/UefiDpLib/Dp.c >> @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { >>#endif // PROFILING_IMPLEMENTED >> {L"-x", TypeFlag}, // -x eXclude Cumulative Items >> {L"-i", TypeFlag}, // -i Display Identifier >> + {L"-c", TypeValue}, // -c Display cumulative data. >> {L"-n", TypeValue}, // -n # Number of records to display for A and R >> {L"-t", TypeValue}, // -t # Threshold of interest >> {NULL, TypeMax} >> @@ -164,6 +165,9 @@ ShellCommandRunDp ( >> BOOLEAN TraceMode; >> BOOLEAN ProfileMode; >> BOOLEAN ExcludeMode; >> + BOOLEAN CumulativeMode; >> + CONST CHAR16 *CustomCumulativeToken; >> + PERF_CUM_DATA *CustomCumulativeData; >> >> StringPtr = NULL; >> SummaryMode = FALSE; >> @@ -173,6 +177,8 @@ ShellCommandRunDp ( >> TraceMode = FALSE; >> ProfileMode = FALSE; >> ExcludeMode = FALSE; >> + CumulativeMode = FALSE; >> + CustomCumulativeData = NULL; >> >> // Get DP's entry time as soon as possible. >> // This is used as the Shell-Phase end time. >> @@ -210,6 +216,7 @@ ShellCommandRunDp ( >>#endif // PROFILING_IMPLEMENTED >> ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); >> mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); >> + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); >> >> // Options with Values >> CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @
Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
On 2015/11/3 21:09, Shia, Cinnamon wrote: Stat, Thanks for your feedback and review. Will submit the v2 patch for addressing your comments. And submit another patch for PerformancePkg\Dp_App Shia, Since the changes in UefiDpLib has been committed. Will you submit patch for PerformancePkg\Dp_App? Thanks, Star Thanks, Cinnamon Shia -Original Message- From: Zeng, Star [mailto:star.z...@intel.com] Sent: Tuesday, November 3, 2015 11:16 AM To: Shia, Cinnamon; edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data On 2015/11/2 17:11, Cinnamon Shia wrote: Add a new option -c to dump cumulative data. For example: shell> dp -c ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 shell> dp -c DXE ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 DXE 130003000 03000 Signed-off-by: Cinnamon Shia --- ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- ShellPkg/Library/UefiDpLib/DpTrace.c | 55 --- ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes 4 files changed, 87 insertions(+), 10 deletions(-) Could the "HP_ISS" be removed from the patch? Could you help sync the change to PerformancePkg\Dp_App? Thanks, Star diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 --- a/ShellPkg/Library/UefiDpLib/Dp.c +++ b/ShellPkg/Library/UefiDpLib/Dp.c @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { #endif // PROFILING_IMPLEMENTED {L"-x", TypeFlag}, // -x eXclude Cumulative Items {L"-i", TypeFlag}, // -i Display Identifier + {L"-c", TypeValue}, // -c Display cumulative data. {L"-n", TypeValue}, // -n # Number of records to display for A and R {L"-t", TypeValue}, // -t # Threshold of interest {NULL, TypeMax} @@ -164,6 +165,9 @@ ShellCommandRunDp ( BOOLEAN TraceMode; BOOLEAN ProfileMode; BOOLEAN ExcludeMode; + BOOLEAN CumulativeMode; + CONST CHAR16 *CustomCumulativeToken; + PERF_CUM_DATA *CustomCumulativeData; StringPtr = NULL; SummaryMode = FALSE; @@ -173,6 +177,8 @@ ShellCommandRunDp ( TraceMode = FALSE; ProfileMode = FALSE; ExcludeMode = FALSE; + CumulativeMode = FALSE; + CustomCumulativeData = NULL; // Get DP's entry time as soon as possible. // This is used as the Shell-Phase end time. @@ -210,6 +216,7 @@ ShellCommandRunDp ( #endif // PROFILING_IMPLEMENTED ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); // Options with Values CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @@ -244,6 +251,20 @@ ShellCommandRunDp ( InitCumulativeData (); // + // Init the custom cumulative data. + // + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, + L"-c"); 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 // // Get the Performance counter characteristics: @@ -302,8 +323,10 @@ ShellCommandRunDp ( !T && P := (2) Only Profile records are displayed T && P := (3) Same as Default, both are displayed ** **/ - GatherStatistics(); - if
Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
Stat, Thanks for your feedback and review. Will submit the v2 patch for addressing your comments. And submit another patch for PerformancePkg\Dp_App Thanks, Cinnamon Shia -Original Message- From: Zeng, Star [mailto:star.z...@intel.com] Sent: Tuesday, November 3, 2015 11:16 AM To: Shia, Cinnamon; edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data On 2015/11/2 17:11, Cinnamon Shia wrote: > Add a new option -c to dump cumulative data. > For example: > shell> dp -c > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest > Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 >DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > > shell> dp -c DXE > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest > Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 >DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > DXE 130003000 03000 > > Signed-off-by: Cinnamon Shia > --- > ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- > ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- > ShellPkg/Library/UefiDpLib/DpTrace.c | 55 > --- > ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes > 4 files changed, 87 insertions(+), 10 deletions(-) Could the "HP_ISS" be removed from the patch? Could you help sync the change to PerformancePkg\Dp_App? Thanks, Star > > diff --git a/ShellPkg/Library/UefiDpLib/Dp.c > b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 > --- a/ShellPkg/Library/UefiDpLib/Dp.c > +++ b/ShellPkg/Library/UefiDpLib/Dp.c > @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { > #endif // PROFILING_IMPLEMENTED > {L"-x", TypeFlag}, // -x eXclude Cumulative Items > {L"-i", TypeFlag}, // -i Display Identifier > + {L"-c", TypeValue}, // -c Display cumulative data. > {L"-n", TypeValue}, // -n # Number of records to display for A and R > {L"-t", TypeValue}, // -t # Threshold of interest > {NULL, TypeMax} > @@ -164,6 +165,9 @@ ShellCommandRunDp ( > BOOLEAN TraceMode; > BOOLEAN ProfileMode; > BOOLEAN ExcludeMode; > + BOOLEAN CumulativeMode; > + CONST CHAR16 *CustomCumulativeToken; > + PERF_CUM_DATA *CustomCumulativeData; > > StringPtr = NULL; > SummaryMode = FALSE; > @@ -173,6 +177,8 @@ ShellCommandRunDp ( > TraceMode = FALSE; > ProfileMode = FALSE; > ExcludeMode = FALSE; > + CumulativeMode = FALSE; > + CustomCumulativeData = NULL; > > // Get DP's entry time as soon as possible. > // This is used as the Shell-Phase end time. > @@ -210,6 +216,7 @@ ShellCommandRunDp ( > #endif // PROFILING_IMPLEMENTED > ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); > mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); > + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); > > // Options with Values > CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @@ > -244,6 +251,20 @@ ShellCommandRunDp ( > InitCumulativeData (); > > // > + // Init the custom cumulative data. > + // > + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, > + L"-c"); 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 > // > // Get the Performance counter characteristics: > @@ -302,8 +323,10 @@ ShellCommandRun
Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
On 2015/11/2 17:11, Cinnamon Shia wrote: Add a new option -c to dump cumulative data. For example: shell> dp -c ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 shell> dp -c DXE ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 DXE 130003000 03000 Signed-off-by: Cinnamon Shia --- ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- ShellPkg/Library/UefiDpLib/DpTrace.c | 55 --- ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes 4 files changed, 87 insertions(+), 10 deletions(-) Could the "HP_ISS" be removed from the patch? Could you help sync the change to PerformancePkg\Dp_App? Thanks, Star diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 --- a/ShellPkg/Library/UefiDpLib/Dp.c +++ b/ShellPkg/Library/UefiDpLib/Dp.c @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { #endif // PROFILING_IMPLEMENTED {L"-x", TypeFlag}, // -x eXclude Cumulative Items {L"-i", TypeFlag}, // -i Display Identifier + {L"-c", TypeValue}, // -c Display cumulative data. {L"-n", TypeValue}, // -n # Number of records to display for A and R {L"-t", TypeValue}, // -t # Threshold of interest {NULL, TypeMax} @@ -164,6 +165,9 @@ ShellCommandRunDp ( BOOLEAN TraceMode; BOOLEAN ProfileMode; BOOLEAN ExcludeMode; + BOOLEAN CumulativeMode; + CONST CHAR16 *CustomCumulativeToken; + PERF_CUM_DATA *CustomCumulativeData; StringPtr = NULL; SummaryMode = FALSE; @@ -173,6 +177,8 @@ ShellCommandRunDp ( TraceMode = FALSE; ProfileMode = FALSE; ExcludeMode = FALSE; + CumulativeMode = FALSE; + CustomCumulativeData = NULL; // Get DP's entry time as soon as possible. // This is used as the Shell-Phase end time. @@ -210,6 +216,7 @@ ShellCommandRunDp ( #endif // PROFILING_IMPLEMENTED ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); // Options with Values CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @@ -244,6 +251,20 @@ ShellCommandRunDp ( InitCumulativeData (); // + // Init the custom cumulative data. + // + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c"); + 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 // // Get the Performance counter characteristics: @@ -302,8 +323,10 @@ ShellCommandRunDp ( !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); } @@ -326,7 +349,7 @@ ShellCommandRunDp ( if ( ! EFI_ERROR( Status)) { ProcessPeims (); ProcessGlobal (); - ProcessCumulative (); + ProcessCumulative (NULL); } } } @@ -339,6 +362,10 @@ ShellCommandRunDp ( } SHELL_FREE_NON_NULL (StringPtr); + if (CustomCumulativeData != NULL) { +SHELL_FREE_NON_NULL (CustomCumulativeData->Name); + } + SHELL_FREE_NON_NULL (CustomCumulativeData); return SHELL_SUCCESS; } diff --git a/ShellPkg/Library/UefiDpLib/DpInternal
Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
Cinnamon, Can you send the UNI file as an attachment please? Jaben, Can you help commit the code after reviewing the UNI file? Thanks, --Samer -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Carsey, Jaben Sent: Monday, November 02, 2015 10:37 AM To: Shia, Cinnamon ; edk2-devel@lists.01.org Cc: Carsey, Jaben Subject: Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data Code looks good. I can't tell must about your UNI file change. Reviewed-by: Jaben Carsey > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Cinnamon Shia > Sent: Monday, November 02, 2015 1:12 AM > To: edk2-devel@lists.01.org > Subject: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping > cumulative data > Importance: High > > Add a new option -c to dump cumulative data. > For example: > shell> dp -c > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest >Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 > DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > > shell> dp -c DXE > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest >Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 > DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > DXE 130003000 03000 > > Signed-off-by: Cinnamon Shia > --- > ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- > ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- > ShellPkg/Library/UefiDpLib/DpTrace.c | 55 > --- > ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes > 4 files changed, 87 insertions(+), 10 deletions(-) > > diff --git a/ShellPkg/Library/UefiDpLib/Dp.c > b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 > --- a/ShellPkg/Library/UefiDpLib/Dp.c > +++ b/ShellPkg/Library/UefiDpLib/Dp.c > @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { > #endif // PROFILING_IMPLEMENTED >{L"-x", TypeFlag}, // -x eXclude Cumulative Items >{L"-i", TypeFlag}, // -i Display Identifier > + {L"-c", TypeValue}, // -c Display cumulative data. >{L"-n", TypeValue}, // -n # Number of records to display for A and R >{L"-t", TypeValue}, // -t # Threshold of interest >{NULL, TypeMax} > @@ -164,6 +165,9 @@ ShellCommandRunDp ( >BOOLEAN TraceMode; >BOOLEAN ProfileMode; >BOOLEAN ExcludeMode; > + BOOLEAN CumulativeMode; > + CONST CHAR16 *CustomCumulativeToken; > + PERF_CUM_DATA *CustomCumulativeData; > >StringPtr = NULL; >SummaryMode = FALSE; > @@ -173,6 +177,8 @@ ShellCommandRunDp ( >TraceMode = FALSE; >ProfileMode = FALSE; >ExcludeMode = FALSE; > + CumulativeMode = FALSE; > + CustomCumulativeData = NULL; > >// Get DP's entry time as soon as possible. >// This is used as the Shell-Phase end time. > @@ -210,6 +216,7 @@ ShellCommandRunDp ( #endif // > PROFILING_IMPLEMENTED >ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); >mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); > + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); > >// Options with Values >CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @@ > -244,6 +251,20 @@ ShellCommandRunDp ( >InitCumulativeData (); > >// > + // Init the custom cumulative data. > + // > + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"- > c"); > + if (CustomCumulativeToken != NULL) { > +CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA)); > +CustomCumulativeData->MinDur = 0; > +CustomCumulativeData->MaxDur = 0; > +CustomCumulativeData->Count = 0; > +CustomCumulativeData->Duration = 0; > +CustomCumulativeData->Name = AllocateZeroPool
Re: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
Code looks good. I can't tell must about your UNI file change. Reviewed-by: Jaben Carsey > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Cinnamon Shia > Sent: Monday, November 02, 2015 1:12 AM > To: edk2-devel@lists.01.org > Subject: [edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative > data > Importance: High > > Add a new option -c to dump cumulative data. > For example: > shell> dp -c > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest >Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 > DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > > shell> dp -c DXE > ==[ Cumulative ] > (Times in microsec.) Cumulative Average ShortestLongest >Name CountDurationDurationDurationDuration > LoadImage: 200 1007000 0 10 > StartImage:2002000 9 0 700 > DB:Start:2002000 10 0 900 > DB:Support: 20 10 0 07000 > DXE 130003000 03000 > > Signed-off-by: Cinnamon Shia > --- > ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- > ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- > ShellPkg/Library/UefiDpLib/DpTrace.c | 55 > --- > ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes > 4 files changed, 87 insertions(+), 10 deletions(-) > > diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c > index 62a4e7b..4d109d0 100644 > --- a/ShellPkg/Library/UefiDpLib/Dp.c > +++ b/ShellPkg/Library/UefiDpLib/Dp.c > @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { > #endif // PROFILING_IMPLEMENTED >{L"-x", TypeFlag}, // -x eXclude Cumulative Items >{L"-i", TypeFlag}, // -i Display Identifier > + {L"-c", TypeValue}, // -c Display cumulative data. >{L"-n", TypeValue}, // -n # Number of records to display for A and R >{L"-t", TypeValue}, // -t # Threshold of interest >{NULL, TypeMax} > @@ -164,6 +165,9 @@ ShellCommandRunDp ( >BOOLEAN TraceMode; >BOOLEAN ProfileMode; >BOOLEAN ExcludeMode; > + BOOLEAN CumulativeMode; > + CONST CHAR16 *CustomCumulativeToken; > + PERF_CUM_DATA *CustomCumulativeData; > >StringPtr = NULL; >SummaryMode = FALSE; > @@ -173,6 +177,8 @@ ShellCommandRunDp ( >TraceMode = FALSE; >ProfileMode = FALSE; >ExcludeMode = FALSE; > + CumulativeMode = FALSE; > + CustomCumulativeData = NULL; > >// Get DP's entry time as soon as possible. >// This is used as the Shell-Phase end time. > @@ -210,6 +216,7 @@ ShellCommandRunDp ( > #endif // PROFILING_IMPLEMENTED >ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); >mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); > + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); > >// Options with Values >CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); > @@ -244,6 +251,20 @@ ShellCommandRunDp ( >InitCumulativeData (); > >// > + // Init the custom cumulative data. > + // > + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"- > c"); > + 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 >// >// Get the Performance counter characteristics: > @@ -302,8 +323,10 @@ ShellCommandRunDp ( > !T && P := (2) Only Profile records are displayed > T && P := (3) Same as Default, both are displayed > > *
[edk2] [PATCH 2/2] ShellPkg/UefiDpLib: Support dumping cumulative data
Add a new option -c to dump cumulative data. For example: shell> dp -c ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 shell> dp -c DXE ==[ Cumulative ] (Times in microsec.) Cumulative Average ShortestLongest Name CountDurationDurationDurationDuration LoadImage: 200 1007000 0 10 StartImage:2002000 9 0 700 DB:Start:2002000 10 0 900 DB:Support: 20 10 0 07000 DXE 130003000 03000 Signed-off-by: Cinnamon Shia --- ShellPkg/Library/UefiDpLib/Dp.c | 33 +-- ShellPkg/Library/UefiDpLib/DpInternal.h | 9 +++-- ShellPkg/Library/UefiDpLib/DpTrace.c | 55 --- ShellPkg/Library/UefiDpLib/UefiDpLib.uni | Bin 17466 -> 18146 bytes 4 files changed, 87 insertions(+), 10 deletions(-) diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c index 62a4e7b..4d109d0 100644 --- a/ShellPkg/Library/UefiDpLib/Dp.c +++ b/ShellPkg/Library/UefiDpLib/Dp.c @@ -79,6 +79,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { #endif // PROFILING_IMPLEMENTED {L"-x", TypeFlag}, // -x eXclude Cumulative Items {L"-i", TypeFlag}, // -i Display Identifier + {L"-c", TypeValue}, // -c Display cumulative data. {L"-n", TypeValue}, // -n # Number of records to display for A and R {L"-t", TypeValue}, // -t # Threshold of interest {NULL, TypeMax} @@ -164,6 +165,9 @@ ShellCommandRunDp ( BOOLEAN TraceMode; BOOLEAN ProfileMode; BOOLEAN ExcludeMode; + BOOLEAN CumulativeMode; + CONST CHAR16 *CustomCumulativeToken; + PERF_CUM_DATA *CustomCumulativeData; StringPtr = NULL; SummaryMode = FALSE; @@ -173,6 +177,8 @@ ShellCommandRunDp ( TraceMode = FALSE; ProfileMode = FALSE; ExcludeMode = FALSE; + CumulativeMode = FALSE; + CustomCumulativeData = NULL; // Get DP's entry time as soon as possible. // This is used as the Shell-Phase end time. @@ -210,6 +216,7 @@ ShellCommandRunDp ( #endif // PROFILING_IMPLEMENTED ExcludeMode = ShellCommandLineGetFlag (ParamPackage, L"-x"); mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i"); + CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c"); // Options with Values CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n"); @@ -244,6 +251,20 @@ ShellCommandRunDp ( InitCumulativeData (); // + // Init the custom cumulative data. + // + CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c"); + 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 // // Get the Performance counter characteristics: @@ -302,8 +323,10 @@ ShellCommandRunDp ( !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); } @@ -326,7 +349,7 @@ ShellCommandRunDp ( if ( ! EFI_ERROR( Status)) { ProcessPeims (); ProcessGlobal (); - ProcessCumulative (); + ProcessCumulative (NULL); } } } @@ -339,6 +362,10 @@ ShellCommandRunDp ( } SHELL_FREE_NON_NULL (StringPtr); + if (CustomCumulativeData != NULL) { +SHELL_FREE_NON_NULL (CustomCumulativeData->Name); + } + SHELL_FREE_NON_NULL (CustomCumulativeData); return SHELL_SUCCESS; } diff --git a/ShellPkg/Library/UefiDpLib/DpInternal.h b/ShellPkg/Library/UefiDpLib/DpInternal.h index 9b8163a..9d94943 100644 --- a/ShellPkg/Library/UefiDpLib/DpInternal.h +++ b/ShellPkg/Library/UefiDpLib/DpInternal.h @@ -172,10 +172,13