diff options
author | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-04-24 09:15:10 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-04-24 09:15:10 +0000 |
commit | 0b84f444de5b7d3f4224e728c9f2232742c0462d (patch) | |
tree | 4b84614597e5b49ee1c8562071b78e2ddaf34b0a /PerformancePkg | |
parent | f0da4d7d9addb4cbb097286095b146547a8e5122 (diff) | |
download | edk2-platforms-0b84f444de5b7d3f4224e728c9f2232742c0462d.tar.xz |
Add new extension PerformanceLib APIs to store ID info.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13216 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'PerformancePkg')
-rw-r--r-- | PerformancePkg/Dp_App/Dp.c | 10 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/Dp.h | 3 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/DpInternal.h | 3 | ||||
-rw-r--r-- | PerformancePkg/Dp_App/DpStrings.uni | bin | 29764 -> 36606 bytes | |||
-rw-r--r-- | PerformancePkg/Dp_App/DpTrace.c | 213 |
5 files changed, 162 insertions, 67 deletions
diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c index 5059892192..57144a8fb8 100644 --- a/PerformancePkg/Dp_App/Dp.c +++ b/PerformancePkg/Dp_App/Dp.c @@ -13,7 +13,7 @@ Dp uses this information to group records in different ways. It also uses
timer information to calculate elapsed time for each measurement.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<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
@@ -49,6 +49,7 @@ CHAR16 *mPrintTokenBuffer = NULL; CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
UINT64 mInterestThreshold;
+BOOLEAN mShowId = FALSE;
PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.
@@ -79,6 +80,7 @@ PARAM_ITEM_LIST ParamList[] = { {STRING_TOKEN (STR_DP_OPTION_UT), TypeFlag}, // -T Dump Trace Data
#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_LN), TypeValue}, // -n # Number of records to display for A and R
{STRING_TOKEN (STR_DP_OPTION_LT), TypeValue} // -t # Threshold of interest
};
@@ -135,6 +137,7 @@ ShowHelp( void ) #endif // PROFILING_IMPLEMENTED
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_HELP));
Print(L"\n");
}
@@ -214,6 +217,7 @@ InitializeDp ( EFI_STRING StringDpOptionLx;
EFI_STRING StringDpOptionLn;
EFI_STRING StringDpOptionLt;
+ EFI_STRING StringDpOptionLi;
SummaryMode = FALSE;
VerboseMode = FALSE;
@@ -236,6 +240,7 @@ InitializeDp ( StringDpOptionLx = NULL;
StringDpOptionLn = NULL;
StringDpOptionLt = NULL;
+ StringDpOptionLi = NULL;
StringPtr = NULL;
// Get DP's entry time as soon as possible.
@@ -283,6 +288,7 @@ InitializeDp ( 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);
+ StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);
// Boolean Options
//
@@ -296,6 +302,7 @@ InitializeDp ( ProfileMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUp);
#endif // PROFILING_IMPLEMENTED
ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
+ mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);
// Options with Values
CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
@@ -447,6 +454,7 @@ InitializeDp ( SafeFreePool (StringDpOptionLx);
SafeFreePool (StringDpOptionLn);
SafeFreePool (StringDpOptionLt);
+ SafeFreePool (StringDpOptionLi);
SafeFreePool (StringPtr);
SafeFreePool (mPrintTokenBuffer);
diff --git a/PerformancePkg/Dp_App/Dp.h b/PerformancePkg/Dp_App/Dp.h index 489c9684db..5fc3335279 100644 --- a/PerformancePkg/Dp_App/Dp.h +++ b/PerformancePkg/Dp_App/Dp.h @@ -1,7 +1,7 @@ /** @file
Common declarations for the Dp Performance Reporting Utility.
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<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
@@ -83,6 +83,7 @@ typedef struct { CONST CHAR8 *Module; ///< Module string name.
UINT64 StartTimeStamp; ///< Start time point.
UINT64 EndTimeStamp; ///< End time point.
+ UINT32 Identifier; ///< Identifier.
} MEASUREMENT_RECORD;
typedef struct {
diff --git a/PerformancePkg/Dp_App/DpInternal.h b/PerformancePkg/Dp_App/DpInternal.h index 223feef9b8..eb4f274892 100644 --- a/PerformancePkg/Dp_App/DpInternal.h +++ b/PerformancePkg/Dp_App/DpInternal.h @@ -6,7 +6,7 @@ Dp application. In addition to global data, function declarations for
DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<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
@@ -28,6 +28,7 @@ extern CHAR16 *mPrintTokenBuffer; extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
extern UINT64 mInterestThreshold;
+extern BOOLEAN mShowId;
extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.
diff --git a/PerformancePkg/Dp_App/DpStrings.uni b/PerformancePkg/Dp_App/DpStrings.uni Binary files differindex 22925ba348..eddc02c2b8 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 a7c2049b85..1ba2b72ba4 100644 --- a/PerformancePkg/Dp_App/DpTrace.c +++ b/PerformancePkg/Dp_App/DpTrace.c @@ -1,7 +1,7 @@ /** @file
Trace reporting for the Dp utility.
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<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
@@ -54,13 +54,14 @@ GatherStatistics( INTN TIndex;
LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
{
++SummaryData.NumTrace; // Count the number of TRACE Measurement records
if (Measurement.EndTimeStamp == 0) {
@@ -168,27 +169,31 @@ DumpAllTrace( // Display only records with Elapsed times >= mInterestThreshold
// Display driver names in Module field for records with Handles.
//
- PrintToken (STRING_TOKEN (STR_DP_ALL_HEADR) );
- PrintToken (STRING_TOKEN (STR_DP_DASHES) );
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_ALL_HEADR2) );
+ PrintToken (STRING_TOKEN (STR_DP_ALL_DASHES2) );
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_ALL_HEADR) );
+ PrintToken (STRING_TOKEN (STR_DP_DASHES) );
+ }
LogEntryKey = 0;
Count = 0;
Index = 0;
while ( WITHIN_LIMIT(Count, Limit) &&
- ((LogEntryKey = GetPerformanceMeasurement (
+ ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
)
{
++Index; // Count every record. First record is 1.
ElapsedTime = 0;
- if (IncFlag != NULL) {
- FreePool ((void *)IncFlag);
- }
+ SafeFreePool ((VOID *) IncFlag);
if (Measurement.EndTimeStamp != 0) {
Duration = GetDuration (&Measurement);
ElapsedTime = DurationInMicroSeconds ( Duration );
@@ -225,20 +230,32 @@ DumpAllTrace( mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
mUnicodeToken[13] = 0;
- PrintToken( STRING_TOKEN (STR_DP_ALL_VARS),
- Index, // 1 based, Which measurement record is being printed
- IncFlag,
- Measurement.Handle,
- mGaugeString,
- mUnicodeToken,
- ElapsedTime
- );
+ if (mShowId) {
+ PrintToken( STRING_TOKEN (STR_DP_ALL_VARS2),
+ Index, // 1 based, Which measurement record is being printed
+ IncFlag,
+ Measurement.Handle,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ PrintToken( STRING_TOKEN (STR_DP_ALL_VARS),
+ Index, // 1 based, Which measurement record is being printed
+ IncFlag,
+ Measurement.Handle,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
}
}
if (HandleBuffer != &TempHandle) {
FreePool (HandleBuffer);
}
- FreePool ((void *)IncFlag);
+ SafeFreePool ((VOID *) IncFlag);
}
/**
@@ -282,20 +299,26 @@ DumpRawTrace( FreePool (StringPtr);
FreePool (StringPtrUnknown);
- PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR) );
- PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES) );
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR2) );
+ PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES2) );
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_RAW_HEADR) );
+ PrintToken (STRING_TOKEN (STR_DP_RAW_DASHES) );
+ }
LogEntryKey = 0;
Count = 0;
Index = 0;
while ( WITHIN_LIMIT(Count, Limit) &&
- ((LogEntryKey = GetPerformanceMeasurement (
+ ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
)
{
++Index; // Count every record. First record is 1.
@@ -310,14 +333,27 @@ DumpRawTrace( continue;
}
++Count; // Count the number of records printed
- PrintToken (STRING_TOKEN (STR_DP_RAW_VARS),
- Index, // 1 based, Which measurement record is being printed
- Measurement.Handle,
- Measurement.StartTimeStamp,
- Measurement.EndTimeStamp,
- Measurement.Token,
- Measurement.Module
- );
+
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_RAW_VARS2),
+ Index, // 1 based, Which measurement record is being printed
+ Measurement.Handle,
+ Measurement.StartTimeStamp,
+ Measurement.EndTimeStamp,
+ Measurement.Token,
+ Measurement.Module,
+ Measurement.Identifier
+ );
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_RAW_VARS),
+ Index, // 1 based, Which measurement record is being printed
+ Measurement.Handle,
+ Measurement.StartTimeStamp,
+ Measurement.EndTimeStamp,
+ Measurement.Token,
+ Measurement.Module
+ );
+ }
}
}
@@ -363,13 +399,14 @@ ProcessPhases( FreePool (StringPtrUnknown);
LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
{
if (AsciiStrnCmp (Measurement.Token, ALit_SHELL, PERF_TOKEN_LENGTH) == 0) {
Measurement.EndTimeStamp = Ticker;
@@ -512,18 +549,23 @@ ProcessHandles( Print (L"There are %,d Handles defined.\n", (Size / sizeof(HandleBuffer[0])));
#endif
- PrintToken (STRING_TOKEN (STR_DP_HANDLE_SECTION) );
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_HANDLE_SECTION2) );
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_HANDLE_SECTION) );
+ }
PrintToken (STRING_TOKEN (STR_DP_DASHES) );
LogEntryKey = 0;
Count = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
{
Count++;
Duration = GetDuration (&Measurement);
@@ -549,14 +591,26 @@ ProcessHandles( mUnicodeToken[11] = 0;
if (mGaugeString[0] != 0) {
// Display the record if it has a valid handle.
- PrintToken (
- STRING_TOKEN (STR_DP_HANDLE_VARS),
- Count, // 1 based, Which measurement record is being printed
- Index + 1, // 1 based, Which handle is being printed
- mGaugeString,
- mUnicodeToken,
- ElapsedTime
- );
+ if (mShowId) {
+ PrintToken (
+ STRING_TOKEN (STR_DP_HANDLE_VARS2),
+ Count, // 1 based, Which measurement record is being printed
+ Index + 1, // 1 based, Which handle is being printed
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ PrintToken (
+ STRING_TOKEN (STR_DP_HANDLE_VARS),
+ Count, // 1 based, Which measurement record is being printed
+ Index + 1, // 1 based, Which handle is being printed
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
}
}
}
@@ -592,17 +646,22 @@ ProcessPeims( FreePool (StringPtr);
FreePool (StringPtrUnknown);
- PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION));
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION2));
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_PEIM_SECTION));
+ }
PrintToken (STRING_TOKEN (STR_DP_DASHES));
TIndex = 0;
LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
{
TIndex++;
if ((Measurement.EndTimeStamp == 0) ||
@@ -615,12 +674,22 @@ ProcessPeims( ElapsedTime = DurationInMicroSeconds ( Duration ); // Calculate elapsed time in microseconds
if (ElapsedTime >= mInterestThreshold) {
// PEIM FILE Handle is the start address of its FFS file that contains its file guid.
- PrintToken (STRING_TOKEN (STR_DP_PEIM_VARS),
- TIndex, // 1 based, Which measurement record is being printed
- Measurement.Handle, // base address
- Measurement.Handle, // file guid
- ElapsedTime
- );
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_PEIM_VARS2),
+ TIndex, // 1 based, Which measurement record is being printed
+ Measurement.Handle, // base address
+ Measurement.Handle, // file guid
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_PEIM_VARS),
+ TIndex, // 1 based, Which measurement record is being printed
+ Measurement.Handle, // base address
+ Measurement.Handle, // file guid
+ ElapsedTime
+ );
+ }
}
}
}
@@ -654,23 +723,28 @@ ProcessGlobal( FreePool (StringPtr);
FreePool (StringPtrUnknown);
- PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION));
+ if (mShowId) {
+ PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION2));
+ } else {
+ PrintToken (STRING_TOKEN (STR_DP_GLOBAL_SECTION));
+ }
PrintToken (STRING_TOKEN (STR_DP_DASHES));
Index = 1;
LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
+ while ((LogEntryKey = GetPerformanceMeasurementEx (
LogEntryKey,
&Measurement.Handle,
&Measurement.Token,
&Measurement.Module,
&Measurement.StartTimeStamp,
- &Measurement.EndTimeStamp)) != 0)
+ &Measurement.EndTimeStamp,
+ &Measurement.Identifier)) != 0)
{
AsciiStrToUnicodeStr (Measurement.Module, mGaugeString);
AsciiStrToUnicodeStr (Measurement.Token, mUnicodeToken);
- mGaugeString[26] = 0;
+ mGaugeString[25] = 0;
mUnicodeToken[31] = 0;
if ( ! ( IsPhase( &Measurement) ||
(Measurement.Handle != NULL) ||
@@ -680,13 +754,24 @@ ProcessGlobal( Duration = GetDuration (&Measurement);
ElapsedTime = DurationInMicroSeconds ( Duration );
if (ElapsedTime >= mInterestThreshold) {
- PrintToken (
- STRING_TOKEN (STR_DP_GLOBAL_VARS),
- Index,
- mGaugeString,
- mUnicodeToken,
- ElapsedTime
- );
+ if (mShowId) {
+ PrintToken (
+ STRING_TOKEN (STR_DP_GLOBAL_VARS2),
+ Index,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime,
+ Measurement.Identifier
+ );
+ } else {
+ PrintToken (
+ STRING_TOKEN (STR_DP_GLOBAL_VARS),
+ Index,
+ mGaugeString,
+ mUnicodeToken,
+ ElapsedTime
+ );
+ }
}
}
Index++;
|