diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-11-09 03:22:42 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-11-09 03:22:42 +0000 |
commit | 8835954602834c41db448064a7205ac0b8b66189 (patch) | |
tree | 7323c831214fa68d97c9d843a91bc759f206de9c | |
parent | 224beee0fa29b9b10cda6c1d25307371368a1040 (diff) | |
download | edk2-8835954602834c41db448064a7205ac0b8b66189.tar.gz edk2-8835954602834c41db448064a7205ac0b8b66189.tar.bz2 edk2-8835954602834c41db448064a7205ac0b8b66189.zip |
Move some define code to the uni file. Also fixed some memory leak.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11015 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | PerformancePkg/Dp_App/Dp.c | 169 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/Dp.h | 6 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/DpProfile.c | 13 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/DpStrings.uni | bin | 29968 -> 36244 bytes | |||
-rw-r--r-- | PerformancePkg/Dp_App/DpTrace.c | 51 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/DpUtilities.c | 3 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/Literals.c | 23 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/Literals.h | 23 |
8 files changed, 197 insertions, 91 deletions
diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c index 3237138b22..b8e07c5cca 100644 --- a/PerformancePkg/Dp_App/Dp.c +++ b/PerformancePkg/Dp_App/Dp.c @@ -44,6 +44,7 @@ /// Module-Global Variables
///@{
EFI_HII_HANDLE gHiiHandle;
+SHELL_PARAM_ITEM *DpParamList = NULL;
CHAR16 *mPrintTokenBuffer = NULL;
CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
CHAR16 mUnicodeToken[PERF_TOKEN_LENGTH + 1];
@@ -65,27 +66,52 @@ PERF_CUM_DATA CumData[] = { /// Number of items for which we are gathering cumulative statistics.
UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA);
-SHELL_PARAM_ITEM DpParamList[] = {
- {STR_DP_OPTION_QH, TypeFlag}, // -? Help
- {STR_DP_OPTION_LH, TypeFlag}, // -h Help
- {STR_DP_OPTION_UH, TypeFlag}, // -H Help
- {STR_DP_OPTION_LV, TypeFlag}, // -v Verbose Mode
- {STR_DP_OPTION_UA, TypeFlag}, // -A All, Cooked
- {STR_DP_OPTION_UR, TypeFlag}, // -R RAW All
- {STR_DP_OPTION_LS, TypeFlag}, // -s Summary
+PARAM_ITEM_LIST ParamList[] = {
+ {STRING_TOKEN (STR_DP_OPTION_QH), TypeFlag}, // -? Help
+ {STRING_TOKEN (STR_DP_OPTION_LH), TypeFlag}, // -h Help
+ {STRING_TOKEN (STR_DP_OPTION_UH), TypeFlag}, // -H Help
+ {STRING_TOKEN (STR_DP_OPTION_LV), TypeFlag}, // -v Verbose Mode
+ {STRING_TOKEN (STR_DP_OPTION_UA), TypeFlag}, // -A All, Cooked
+ {STRING_TOKEN (STR_DP_OPTION_UR), TypeFlag}, // -R RAW All
+ {STRING_TOKEN (STR_DP_OPTION_LS), TypeFlag}, // -s Summary
#if PROFILING_IMPLEMENTED
- {STR_DP_OPTION_UP, TypeFlag}, // -P Dump Profile Data
- {STR_DP_OPTION_UT, TypeFlag}, // -T Dump Trace Data
+ {STRING_TOKEN (STR_DP_OPTION_UP), TypeFlag}, // -P Dump Profile Data
+ {STRING_TOKEN (STR_DP_OPTION_UT), TypeFlag}, // -T Dump Trace Data
#endif
- {STR_DP_OPTION_LX, TypeFlag}, // -x eXclude Cumulative Items
- {STR_DP_OPTION_LN, TypeValue}, // -n # Number of records to display for A and R
- {STR_DP_OPTION_LT, TypeValue}, // -t # Threshold of interest
- {NULL, TypeMax}
+ {STRING_TOKEN (STR_DP_OPTION_LX), TypeFlag}, // -x eXclude Cumulative Items
+ {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
};
///@}
/**
+ Transfer the param list value and get the command line parse.
+
+**/
+VOID
+InitialShellParamList( void )
+{
+ UINT32 ListIndex;
+ UINT32 ListLength;
+
+ //
+ // Allocate one more for the end tag.
+ //
+ ListLength = sizeof (ParamList) / sizeof (ParamList[0]) + 1;
+ DpParamList = AllocatePool (sizeof (SHELL_PARAM_ITEM) * ListLength);
+ ASSERT (DpParamList != NULL);
+
+ for (ListIndex = 0; ListIndex < ListLength - 1; ListIndex ++)
+ {
+ DpParamList[ListIndex].Name = HiiGetString (gHiiHandle, ParamList[ListIndex].Token, NULL);
+ DpParamList[ListIndex].Type = ParamList[ListIndex].Type;
+ }
+ DpParamList[ListIndex].Name = NULL;
+ DpParamList[ListIndex].Type = TypeMax;
+}
+
+/**
Display Usage and Help information.
**/
VOID
@@ -120,10 +146,11 @@ VOID DumpStatistics( void )
{
EFI_STRING StringPtr;
-
- StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
+ EFI_STRING StringPtrUnknown;
+ StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
PrintToken( STRING_TOKEN (STR_DP_STATS_NUMTRACE), SummaryData.NumTrace);
PrintToken( STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), SummaryData.NumIncomplete);
@@ -134,6 +161,8 @@ DumpStatistics( void ) #if PROFILING_IMPLEMENTED
PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPROFILE), SummaryData.NumProfile);
#endif // PROFILING_IMPLEMENTED
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
}
/**
@@ -156,7 +185,8 @@ InitializeDp ( {
UINT64 Freq;
UINT64 Ticker;
-
+ UINT32 ListIndex;
+
LIST_ENTRY *ParamPackage;
CONST CHAR16 *CmdLineArg;
EFI_STRING StringPtr;
@@ -171,6 +201,20 @@ InitializeDp ( BOOLEAN ProfileMode;
BOOLEAN ExcludeMode;
+ EFI_STRING StringDpOptionQh;
+ EFI_STRING StringDpOptionLh;
+ EFI_STRING StringDpOptionUh;
+ EFI_STRING StringDpOptionLv;
+ EFI_STRING StringDpOptionUs;
+ EFI_STRING StringDpOptionLs;
+ EFI_STRING StringDpOptionUa;
+ EFI_STRING StringDpOptionUr;
+ EFI_STRING StringDpOptionUt;
+ EFI_STRING StringDpOptionUp;
+ EFI_STRING StringDpOptionLx;
+ EFI_STRING StringDpOptionLn;
+ EFI_STRING StringDpOptionLt;
+
SummaryMode = FALSE;
VerboseMode = FALSE;
AllMode = FALSE;
@@ -178,6 +222,22 @@ InitializeDp ( TraceMode = FALSE;
ProfileMode = FALSE;
ExcludeMode = FALSE;
+
+ StringDpOptionQh = NULL;
+ StringDpOptionLh = NULL;
+ StringDpOptionUh = NULL;
+ StringDpOptionLv = NULL;
+ StringDpOptionUs = NULL;
+ StringDpOptionLs = NULL;
+ StringDpOptionUa = NULL;
+ StringDpOptionUr = NULL;
+ StringDpOptionUt = NULL;
+ StringDpOptionUp = NULL;
+ StringDpOptionLx = NULL;
+ StringDpOptionLn = NULL;
+ StringDpOptionLt = NULL;
+ StringPtr = NULL;
+
// Get DP's entry time as soon as possible.
// This is used as the Shell-Phase end time.
//
@@ -188,6 +248,10 @@ InitializeDp ( gHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, DPStrings, NULL);
ASSERT (gHiiHandle != NULL);
+ // Initial the command list
+ //
+ InitialShellParamList ();
+
/****************************************************************************
**** Process Command Line arguments ****
****************************************************************************/
@@ -198,27 +262,43 @@ InitializeDp ( ShowHelp();
}
else {
- if (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_QH) ||
- ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LH) ||
- ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UH))
+ StringDpOptionQh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_QH), NULL);
+ StringDpOptionLh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LH), NULL);
+ StringDpOptionUh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UH), NULL);
+
+ if (ShellCommandLineGetFlag (ParamPackage, StringDpOptionQh) ||
+ ShellCommandLineGetFlag (ParamPackage, StringDpOptionLh) ||
+ ShellCommandLineGetFlag (ParamPackage, StringDpOptionUh))
{
ShowHelp();
}
else {
+ StringDpOptionLv = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LV), NULL);
+ StringDpOptionUs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_US), NULL);
+ StringDpOptionLs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LS), NULL);
+ StringDpOptionUa = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UA), NULL);
+ StringDpOptionUr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UR), NULL);
+ StringDpOptionUt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UT), NULL);
+ StringDpOptionUp = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UP), NULL);
+ StringDpOptionLx = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LX), NULL);
+ StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);
+ StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);
+
// Boolean Options
- VerboseMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LV));
- SummaryMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_US) ||
- ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LS));
- AllMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UA));
- RawMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UR));
+ //
+ VerboseMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLv);
+ SummaryMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUs) ||
+ ShellCommandLineGetFlag (ParamPackage, StringDpOptionLs);
+ AllMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUa);
+ RawMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUr);
#if PROFILING_IMPLEMENTED
- TraceMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UT));
- ProfileMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UP));
+ TraceMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUt);
+ ProfileMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUp);
#endif // PROFILING_IMPLEMENTED
- ExcludeMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LX));
+ ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
// Options with Values
- CmdLineArg = ( ShellCommandLineGetValue (ParamPackage, STR_DP_OPTION_LN));
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
if (CmdLineArg == NULL) {
Number2Display = DEFAULT_DISPLAYCOUNT;
}
@@ -228,7 +308,7 @@ InitializeDp ( Number2Display = MAXIMUM_DISPLAYCOUNT;
}
}
- CmdLineArg = (ShellCommandLineGetValue (ParamPackage, STR_DP_OPTION_LT));
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLt);
if (CmdLineArg == NULL) {
mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us
}
@@ -344,7 +424,32 @@ InitializeDp ( }
}
}
- (void) FreePool (mPrintTokenBuffer);
+
+ // Free the memory allocate from HiiGetString
+ //
+ ListIndex = 0;
+ while (DpParamList[ListIndex].Name != NULL) {
+ FreePool (DpParamList[ListIndex].Name);
+ ListIndex ++;
+ }
+ FreePool (DpParamList);
+
+ FreePool (StringDpOptionQh);
+ FreePool (StringDpOptionLh);
+ FreePool (StringDpOptionUh);
+ FreePool (StringDpOptionLv);
+ FreePool (StringDpOptionUs);
+ FreePool (StringDpOptionLs);
+ FreePool (StringDpOptionUa);
+ FreePool (StringDpOptionUr);
+ FreePool (StringDpOptionUt);
+ FreePool (StringDpOptionUp);
+ FreePool (StringDpOptionLx);
+ FreePool (StringDpOptionLn);
+ FreePool (StringDpOptionLt);
+ FreePool (StringPtr);
+ FreePool (mPrintTokenBuffer);
+
HiiRemovePackages (gHiiHandle);
return Status;
}
diff --git a/PerformancePkg/Dp_App/Dp.h b/PerformancePkg/Dp_App/Dp.h index 072ae1b983..06dbe044ab 100644 --- a/PerformancePkg/Dp_App/Dp.h +++ b/PerformancePkg/Dp_App/Dp.h @@ -14,6 +14,8 @@ #ifndef _EFI_APP_DP_H_
#define _EFI_APP_DP_H_
+#include <Library/ShellLib.h>
+
#define DP_MAJOR_VERSION 2
#define DP_MINOR_VERSION 3
@@ -91,4 +93,8 @@ typedef struct { UINT32 Count; ///< Number of measurements accumulated.
} PROFILE_RECORD;
+typedef struct {
+ UINT16 Token;
+ SHELL_PARAM_TYPE Type;
+} PARAM_ITEM_LIST;
#endif // _EFI_APP_DP_H_
diff --git a/PerformancePkg/Dp_App/DpProfile.c b/PerformancePkg/Dp_App/DpProfile.c index b0e0eba509..d550760f83 100644 --- a/PerformancePkg/Dp_App/DpProfile.c +++ b/PerformancePkg/Dp_App/DpProfile.c @@ -54,10 +54,15 @@ DumpAllProfile( )
{
EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);
+
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
return;
}
@@ -86,9 +91,13 @@ DumpRawProfile( )
{
EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
return;
}
diff --git a/PerformancePkg/Dp_App/DpStrings.uni b/PerformancePkg/Dp_App/DpStrings.uni Binary files differindex 2d355dffb0..f120985324 100644 --- a/PerformancePkg/Dp_App/DpStrings.uni +++ b/PerformancePkg/Dp_App/DpStrings.uni diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c index 3799af482e..5038473c07 100644 --- a/PerformancePkg/Dp_App/DpTrace.c +++ b/PerformancePkg/Dp_App/DpTrace.c @@ -137,10 +137,13 @@ DumpAllTrace( UINTN Size;
EFI_HANDLE TempHandle;
EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_ALL), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (IncFlag == NULL) ? ALit_UNKNOWN: IncFlag);
+ (IncFlag == NULL) ? StringPtrUnknown : IncFlag);
+ FreePool (StringPtrUnknown);
// Get Handle information
//
@@ -183,13 +186,16 @@ DumpAllTrace( {
++Index; // Count every record. First record is 1.
ElapsedTime = 0;
+ if (IncFlag != NULL) {
+ FreePool ((void *)IncFlag);
+ }
if (Measurement.EndTimeStamp != 0) {
Duration = GetDuration (&Measurement);
ElapsedTime = DurationInMicroSeconds ( Duration );
- IncFlag = STR_DP_COMPLETE;
+ IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_COMPLETE), NULL);
}
else {
- IncFlag = STR_DP_INCOMPLETE; // Mark incomplete records
+ IncFlag = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_INCOMPLETE), NULL); // Mark incomplete records
}
if ((ElapsedTime < mInterestThreshold) ||
((ExcludeFlag) && (GetCumulativeItem(&Measurement) >= 0))
@@ -230,6 +236,7 @@ DumpAllTrace( if (HandleBuffer != &TempHandle) {
FreePool (HandleBuffer);
}
+ FreePool ((void *)IncFlag);
}
/**
@@ -264,10 +271,14 @@ DumpRawTrace( UINTN Index;
EFI_STRING StringPtr;
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWTRACE), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR) );
PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES) );
@@ -331,6 +342,7 @@ ProcessPhases( UINT64 Total;
EFI_STRING StringPtr;
UINTN LogEntryKey;
+ EFI_STRING StringPtrUnknown;
BdsTimeoutValue = 0;
SecTime = 0;
@@ -341,9 +353,12 @@ ProcessPhases( //
// Get Execution Phase Statistics
//
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PHASES), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
@@ -467,10 +482,14 @@ ProcessHandles( UINTN Size;
EFI_HANDLE TempHandle;
EFI_STATUS Status;
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_DRIVERS), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
Size = 0;
HandleBuffer = &TempHandle;
@@ -562,11 +581,14 @@ ProcessPeims( EFI_STRING StringPtr;
UINTN LogEntryKey;
UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
-
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PEIMS), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION));
PrintToken (STRING_TOKEN (STR_DP_DASHES));
@@ -621,10 +643,14 @@ ProcessGlobal( EFI_STRING StringPtr;
UINTN LogEntryKey;
UINTN Index; // Index, or number, of the measurement record being processed
+ EFI_STRING StringPtrUnknown;
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_GENERAL), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION));
PrintToken (STRING_TOKEN (STR_DP_DASHES));
@@ -680,11 +706,14 @@ ProcessCumulative( UINT64 Avgval; // the computed average duration
EFI_STRING StringPtr;
UINTN TIndex;
+ EFI_STRING StringPtrUnknown;
-
+ StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL);
PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
- (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
+ (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
+ FreePool (StringPtr);
+ FreePool (StringPtrUnknown);
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_1));
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_2));
diff --git a/PerformancePkg/Dp_App/DpUtilities.c b/PerformancePkg/Dp_App/DpUtilities.c index 1c40e83950..48e2952aa7 100644 --- a/PerformancePkg/Dp_App/DpUtilities.c +++ b/PerformancePkg/Dp_App/DpUtilities.c @@ -206,6 +206,7 @@ GetNameFromHandle ( );
if (EFI_ERROR (Status)) {
StrCpy (mGaugeString, StringPtr);
+ FreePool (StringPtr);
return ;
}
@@ -225,6 +226,7 @@ GetNameFromHandle ( } else {
StrCpy (mGaugeString, StringPtr);
}
+ FreePool (StringPtr);
return ;
}
@@ -289,6 +291,7 @@ PrintToken ( if (Return > 0 && gST->ConOut != NULL) {
gST->ConOut->OutputString (gST->ConOut, mPrintTokenBuffer);
}
+ FreePool (StringPtr);
return Return;
}
diff --git a/PerformancePkg/Dp_App/Literals.c b/PerformancePkg/Dp_App/Literals.c index 53d9507409..6895f2b15c 100644 --- a/PerformancePkg/Dp_App/Literals.c +++ b/PerformancePkg/Dp_App/Literals.c @@ -21,26 +21,3 @@ CHAR8 const ALit_PEI[] = PEI_TOK; CHAR8 const ALit_BDS[] = BDS_TOK;
CHAR8 const ALit_BdsTO[] = "BdsTimeOut";
CHAR8 const ALit_PEIM[] = "PEIM";
-
-/// UNICODE String literals which should probably be translated
-CHAR16 STR_DP_OPTION_UA[] = L"-A";
-CHAR16 STR_DP_OPTION_LA[] = L"-a";
-CHAR16 STR_DP_OPTION_LN[] = L"-n";
-CHAR16 STR_DP_OPTION_LT[] = L"-t";
-CHAR16 STR_DP_OPTION_UP[] = L"-P";
-CHAR16 STR_DP_OPTION_UR[] = L"-R";
-CHAR16 STR_DP_OPTION_LS[] = L"-s";
-CHAR16 STR_DP_OPTION_US[] = L"-S";
-CHAR16 STR_DP_OPTION_UT[] = L"-T";
-CHAR16 STR_DP_OPTION_LV[] = L"-v";
-CHAR16 STR_DP_OPTION_QH[] = L"-?";
-CHAR16 STR_DP_OPTION_LH[] = L"-h";
-CHAR16 STR_DP_OPTION_UH[] = L"-H";
-CHAR16 STR_DP_OPTION_LX[] = L"-x";
-
-CHAR16 const ALit_UNKNOWN[] = L"Unknown";
-CHAR16 const STR_DP_INCOMPLETE[] = L" I ";
-CHAR16 const STR_DP_COMPLETE[] = L" ";
-
-CHAR8 const ALit_TRUE[] = "TRUE";
-CHAR8 const ALit_FALSE[] = "FALSE";
diff --git a/PerformancePkg/Dp_App/Literals.h b/PerformancePkg/Dp_App/Literals.h index 37d8c5a7bf..7e254d0fd1 100644 --- a/PerformancePkg/Dp_App/Literals.h +++ b/PerformancePkg/Dp_App/Literals.h @@ -23,27 +23,4 @@ extern CHAR8 const ALit_BDS[]; extern CHAR8 const ALit_BdsTO[];
extern CHAR8 const ALit_PEIM[];
-/// UNICODE String literals which should probably be translated
-extern CHAR16 STR_DP_OPTION_UA[];
-extern CHAR16 STR_DP_OPTION_LA[];
-extern CHAR16 STR_DP_OPTION_LN[];
-extern CHAR16 STR_DP_OPTION_LT[];
-extern CHAR16 STR_DP_OPTION_UP[];
-extern CHAR16 STR_DP_OPTION_UR[];
-extern CHAR16 STR_DP_OPTION_LS[];
-extern CHAR16 STR_DP_OPTION_US[];
-extern CHAR16 STR_DP_OPTION_UT[];
-extern CHAR16 STR_DP_OPTION_LV[];
-extern CHAR16 STR_DP_OPTION_QH[];
-extern CHAR16 STR_DP_OPTION_LH[];
-extern CHAR16 STR_DP_OPTION_UH[];
-extern CHAR16 STR_DP_OPTION_LX[];
-
-extern CHAR16 const ALit_UNKNOWN[];
-extern CHAR16 const STR_DP_INCOMPLETE[];
-extern CHAR16 const STR_DP_COMPLETE[];
-
-extern CHAR8 const ALit_TRUE[];
-extern CHAR8 const ALit_FALSE[];
-
#endif // _LITERALS_H_
|