Refine coding style.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11049 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2010-11-12 08:00:23 +00:00
parent 13f06a56bf
commit f97c2415d2
2 changed files with 196 additions and 140 deletions

View File

@ -29,7 +29,10 @@
[Sources] [Sources]
DpStrings.uni DpStrings.uni
Dp.c Dp.c
Dp.h
Literals.h
Literals.c Literals.c
DpInternal.h
DpUtilities.c DpUtilities.c
DpTrace.c DpTrace.c
DpProfile.c DpProfile.c

View File

@ -39,48 +39,58 @@ extern UINT32 const NumCum;
///@} ///@}
/** Calculate an event's duration in timer ticks. /**
* Calculate an event's duration in timer ticks.
* Given the count direction and the event's start and end timer values,
* calculate the duration of the event in timer ticks. Given the count direction and the event's start and end timer values,
* calculate the duration of the event in timer ticks. Information for
* @pre The global TimerInfo structure must have already been initialized the current measurement is pointed to by the parameter.
* before this function is called.
* If the measurement's start time is 1, it indicates that the developer
* @param[in,out] Measurement Pointer to a structure containing data for the current measurement. is indicating that the measurement began at the release of reset.
* The start time is adjusted to the timer's starting count before performing
* @return The 64-bit duration of the event. the elapsed time calculation.
The calculated duration, in ticks, is the absolute difference between
the measurement's ending and starting counts.
@param Measurement Pointer to a MEASUREMENT_RECORD structure containing
data for the current measurement.
@return The 64-bit duration of the event.
**/ **/
UINT64 UINT64
GetDuration ( GetDuration (
IN OUT MEASUREMENT_RECORD *Measurement IN OUT MEASUREMENT_RECORD *Measurement
); );
/** Determine whether the Measurement record is for an EFI Phase. /**
* Determine whether the Measurement record is for an EFI Phase.
* The Token and Module members of the measurement record are checked.
* Module must be empty and Token must be one of SEC, PEI, DXE, or BDS. The Token and Module members of the measurement record are checked.
* Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
* @param[in] Measurement A pointer to the Measurement record to test.
* @param[in] Measurement A pointer to the Measurement record to test.
* @retval TRUE The measurement record is for an EFI Phase.
* @retval FALSE The measurement record is NOT for an EFI Phase. @retval TRUE The measurement record is for an EFI Phase.
@retval FALSE The measurement record is NOT for an EFI Phase.
**/ **/
BOOLEAN BOOLEAN
IsPhase( IsPhase(
IN MEASUREMENT_RECORD *Measurement IN MEASUREMENT_RECORD *Measurement
); );
/** Get the file name portion of the Pdb File Name. /**
* Get the file name portion of the Pdb File Name.
* The portion of the Pdb File Name between the last backslash and
* either a following period or the end of the string is converted The portion of the Pdb File Name between the last backslash and
* to Unicode and copied into UnicodeBuffer. The name is truncated, either a following period or the end of the string is converted
* if necessary, to ensure that UnicodeBuffer is not overrun. to Unicode and copied into UnicodeBuffer. The name is truncated,
* if necessary, to ensure that UnicodeBuffer is not overrun.
* @param[in] PdbFileName Pdb file name.
* @param[out] UnicodeBuffer The resultant Unicode File Name. @param[in] PdbFileName Pdb file name.
* @param[out] UnicodeBuffer The resultant Unicode File Name.
**/ **/
VOID VOID
GetShortPdbFileName ( GetShortPdbFileName (
@ -88,40 +98,46 @@ GetShortPdbFileName (
OUT CHAR16 *UnicodeBuffer OUT CHAR16 *UnicodeBuffer
); );
/** Get a human readable name for an image handle. /**
* Get a human readable name for an image handle.
* @param[in] Handle
* @param[in] Handle
* @post The resulting Unicode name string is stored in the
* mGaugeString global array. @post The resulting Unicode name string is stored in the
* mGaugeString global array.
**/ **/
VOID VOID
GetNameFromHandle ( GetNameFromHandle (
IN EFI_HANDLE Handle IN EFI_HANDLE Handle
); );
/** Calculate the Duration in microseconds. /**
* Calculate the Duration in microseconds.
* Duration is multiplied by 1000, instead of Frequency being divided by 1000
* in order to maintain precision. Since Duration is Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
* a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow. multiplying the result by 1000, in order to maintain precision. Since Duration is
* a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
* @param[in] Duration The event duration in timer ticks.
* The time is calculated as (Duration * 1000) / Timer_Frequency.
* @return A 64-bit value which is the Elapsed time in microseconds.
@param[in] Duration The event duration in timer ticks.
@return A 64-bit value which is the Elapsed time in microseconds.
**/ **/
UINT64 UINT64
DurationInMicroSeconds ( DurationInMicroSeconds (
IN UINT64 Duration IN UINT64 Duration
); );
/** Formatted Print using a Hii Token to reference the localized format string. /**
* Formatted Print using a Hii Token to reference the localized format string.
* @param[in] Token A HII token associated with a localized Unicode string.
* @param[in] Token A HII token associated with a localized Unicode string.
* @return The number of characters converted by UnicodeVSPrint(). @param[in] ... The variable argument list.
*
@return The number of characters converted by UnicodeVSPrint().
**/ **/
UINTN UINTN
PrintToken ( PrintToken (
@ -129,52 +145,60 @@ PrintToken (
... ...
); );
/** Get index of Measurement Record's match in the CumData array. /**
* Get index of Measurement Record's match in the CumData array.
* @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
* If the Measurement's Token value matches a Token in one of the CumData
* @retval <0 Token is not in the CumData array. records, the index of the matching record is returned. The returned
* @retval >=0 Return value is the index into CumData where Token is found. index is a signed value so that negative values can indicate that
the Measurement didn't match any entry in the CumData array.
@param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
@retval <0 Token is not in the CumData array.
@retval >=0 Return value is the index into CumData where Token is found.
**/ **/
INTN INTN
GetCumulativeItem( GetCumulativeItem(
IN MEASUREMENT_RECORD *Measurement IN MEASUREMENT_RECORD *Measurement
); );
/** Collect verbose statistics about the logged performance measurements. /**
* Collect verbose statistics about the logged performance measurements.
* General Summary information for all Trace measurements is gathered and
* stored within the SummaryData structure. This information is both General Summary information for all Trace measurements is gathered and
* used internally by subsequent reporting functions, and displayed stored within the SummaryData structure. This information is both
* at the end of verbose reports. used internally by subsequent reporting functions, and displayed
* at the end of verbose reports.
* @pre The SummaryData and CumData structures must be initialized
* prior to calling this function. @pre The SummaryData and CumData structures must be initialized
* prior to calling this function.
* @post The SummaryData and CumData structures contain statistics for the
* current performance logs. @post The SummaryData and CumData structures contain statistics for the
current performance logs.
**/ **/
VOID VOID
GatherStatistics( GatherStatistics(
VOID VOID
); );
/** Gather and print ALL Trace Records. /**
* Gather and print ALL Trace Records.
* Displays all "interesting" Trace measurements in order.
* The number of records displayed is controlled by: Displays all "interesting" Trace measurements in order.<BR>
* - records with a duration less than mInterestThreshold microseconds are not displayed. The number of records displayed is controlled by:
* - No more than Limit records are displayed. A Limit of zero will not limit the output. - records with a duration less than mInterestThreshold microseconds are not displayed.
* - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - No more than Limit records are displayed. A Limit of zero will not limit the output.
* displayed. - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
* displayed.
* @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
* The mGaugeString and mUnicodeToken global arrays are used for temporary string storage. @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
* They must not be in use by a calling function. The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
* They must not be in use by a calling function.
* @param[in] Limit The number of records to print. Zero is ALL.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. @param[in] Limit The number of records to print. Zero is ALL.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
**/ **/
VOID VOID
DumpAllTrace( DumpAllTrace(
@ -182,22 +206,23 @@ DumpAllTrace(
IN BOOLEAN ExcludeFlag IN BOOLEAN ExcludeFlag
); );
/** Gather and print Raw Trace Records. /**
* Gather and print Raw Trace Records.
* All Trace measurements with a duration greater than or equal to
* mInterestThreshold are printed without interpretation. All Trace measurements with a duration greater than or equal to
* mInterestThreshold are printed without interpretation.
* The number of records displayed is controlled by:
* - records with a duration less than mInterestThreshold microseconds are not displayed. The number of records displayed is controlled by:
* - No more than Limit records are displayed. A Limit of zero will not limit the output. - records with a duration less than mInterestThreshold microseconds are not displayed.
* - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not - No more than Limit records are displayed. A Limit of zero will not limit the output.
* displayed. - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
* displayed.
* @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
* @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
* @param[in] Limit The number of records to print. Zero is ALL.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display. @param[in] Limit The number of records to print. Zero is ALL.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
**/ **/
VOID VOID
DumpRawTrace( DumpRawTrace(
@ -205,10 +230,11 @@ DumpRawTrace(
IN BOOLEAN ExcludeFlag IN BOOLEAN ExcludeFlag
); );
/** Gather and print Major Phase metrics. /**
* Gather and print Major Phase metrics.
* @param[in] Ticker The timer value for the END of Shell phase
* @param[in] Ticker The timer value for the END of Shell phase
**/ **/
VOID VOID
ProcessPhases( ProcessPhases(
@ -216,11 +242,12 @@ ProcessPhases(
); );
/** Gather and print Handle data. /**
* Gather and print Handle data.
* @param[in] ExcludeFlag TRUE if the -x command line flag given. Elides accumulated trace records.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
* @return Status from a call to gBS->LocateHandle().
@return Status from a call to gBS->LocateHandle().
**/ **/
EFI_STATUS EFI_STATUS
ProcessHandles( ProcessHandles(
@ -228,48 +255,62 @@ ProcessHandles(
); );
/** Gather and print PEIM data. /**
* Gather and print PEIM data.
* Only prints complete PEIM records
* Only prints complete PEIM records
**/ **/
VOID VOID
ProcessPeims( ProcessPeims(
VOID VOID
); );
/** Gather and print global data. /**
* Gather and print global data.
* Strips out incomplete or "Execution Phase" records
* Only prints records where Handle is NULL Strips out incomplete or "Execution Phase" records
* Increment TIndex for every record, even skipped ones, so that we have an Only prints records where Handle is NULL
* indication of every measurement record taken. Increment TIndex for every record, even skipped ones, so that we have an
* indication of every measurement record taken.
*
**/ **/
VOID VOID
ProcessGlobal( ProcessGlobal(
VOID VOID
); );
/** Gather and print cumulative data. /**
* Gather and print cumulative data.
* Traverse the measurement records and:
* for each record with a Token listed in the CumData array, Traverse the measurement records and:<BR>
* Update the instance count and the total, minimum, and maximum durations. For each record with a Token listed in the CumData array:<BR>
* Finally, print the gathered cumulative statistics. - Update the instance count and the total, minimum, and maximum durations.
* Finally, print the gathered cumulative statistics.
**/ **/
VOID VOID
ProcessCumulative( ProcessCumulative(
VOID VOID
); );
/** Gather and print ALL Profile Records. /**
* Gather and print ALL Profiling Records.
* @param[in] Limit The number of records to print. Zero is ALL.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display Displays all "interesting" Profile measurements in order.
* The number of records displayed is controlled by:
- records with a duration less than mInterestThreshold microseconds are not displayed.
- No more than Limit records are displayed. A Limit of zero will not limit the output.
- If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
displayed.
@pre The mInterestThreshold global variable is set to the shortest duration to be printed.
The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
They must not be in use by a calling function.
@param[in] Limit The number of records to print. Zero is ALL.
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
**/ **/
VOID VOID
DumpAllProfile( DumpAllProfile(
@ -277,11 +318,23 @@ DumpAllProfile(
IN BOOLEAN ExcludeFlag IN BOOLEAN ExcludeFlag
); );
/** Gather and print Raw Profile Records. /**
* Gather and print Raw Profile Records.
* @param[in] Limit The number of records to print.
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display All Profile measurements with a duration greater than or equal to
* mInterestThreshold are printed without interpretation.
The number of records displayed is controlled by:
- records with a duration less than mInterestThreshold microseconds are not displayed.
- No more than Limit records are displayed. A Limit of zero will not limit the output.
- If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
displayed.
@pre The mInterestThreshold global variable is set to the shortest duration to be printed.
@param[in] Limit The number of records to print. Zero is ALL.
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
**/ **/
VOID VOID
DumpRawProfile( DumpRawProfile(