mirror of https://github.com/acidanthera/audk.git
Refine code to make code follow the coding style.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11011 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b4221611e9
commit
9dd7461870
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
/// Module-Global Variables
|
/// Module-Global Variables
|
||||||
/// @{
|
///@{
|
||||||
EFI_HII_HANDLE gHiiHandle;
|
EFI_HII_HANDLE gHiiHandle;
|
||||||
CHAR16 *mPrintTokenBuffer = NULL;
|
CHAR16 *mPrintTokenBuffer = NULL;
|
||||||
CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
|
CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
|
||||||
|
@ -83,9 +83,11 @@ SHELL_PARAM_ITEM DpParamList[] = {
|
||||||
{NULL, TypeMax}
|
{NULL, TypeMax}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
///@}
|
||||||
|
|
||||||
/// Display Usage and Help information.
|
/**
|
||||||
|
Display Usage and Help information.
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
ShowHelp( void )
|
ShowHelp( void )
|
||||||
{
|
{
|
||||||
|
@ -111,7 +113,9 @@ ShowHelp( void )
|
||||||
Print(L"\n");
|
Print(L"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Display the trailing Verbose information.
|
/**
|
||||||
|
Display the trailing Verbose information.
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
DumpStatistics( void )
|
DumpStatistics( void )
|
||||||
{
|
{
|
||||||
|
@ -132,15 +136,16 @@ DumpStatistics( void )
|
||||||
#endif // PROFILING_IMPLEMENTED
|
#endif // PROFILING_IMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dump performance data.
|
/**
|
||||||
*
|
Dump performance data.
|
||||||
* @param[in] ImageHandle The image handle.
|
|
||||||
* @param[in] SystemTable The system table.
|
@param[in] ImageHandle The image handle.
|
||||||
*
|
@param[in] SystemTable The system table.
|
||||||
* @retval EFI_SUCCESS Command completed successfully.
|
|
||||||
* @retval EFI_INVALID_PARAMETER Command usage error.
|
@retval EFI_SUCCESS Command completed successfully.
|
||||||
* @retval value Unknown error.
|
@retval EFI_INVALID_PARAMETER Command usage error.
|
||||||
*
|
@retval value Unknown error.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -158,15 +163,21 @@ InitializeDp (
|
||||||
UINTN Number2Display;
|
UINTN Number2Display;
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN SummaryMode = FALSE;
|
BOOLEAN SummaryMode;
|
||||||
BOOLEAN VerboseMode = FALSE;
|
BOOLEAN VerboseMode;
|
||||||
BOOLEAN AllMode = FALSE;
|
BOOLEAN AllMode;
|
||||||
BOOLEAN RawMode = FALSE;
|
BOOLEAN RawMode;
|
||||||
BOOLEAN TraceMode = FALSE;
|
BOOLEAN TraceMode;
|
||||||
BOOLEAN ProfileMode = FALSE;
|
BOOLEAN ProfileMode;
|
||||||
BOOLEAN ExcludeMode = FALSE;
|
BOOLEAN ExcludeMode;
|
||||||
|
|
||||||
|
|
||||||
|
SummaryMode = FALSE;
|
||||||
|
VerboseMode = FALSE;
|
||||||
|
AllMode = FALSE;
|
||||||
|
RawMode = FALSE;
|
||||||
|
TraceMode = FALSE;
|
||||||
|
ProfileMode = FALSE;
|
||||||
|
ExcludeMode = FALSE;
|
||||||
// Get DP's entry time as soon as possible.
|
// Get DP's entry time as soon as possible.
|
||||||
// This is used as the Shell-Phase end time.
|
// This is used as the Shell-Phase end time.
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
**/
|
**/
|
||||||
|
#ifndef _DP_INTELNAL_H_
|
||||||
|
#define _DP_INTELNAL_H_
|
||||||
//
|
//
|
||||||
/// Module-Global Variables
|
/// Module-Global Variables
|
||||||
/// @{
|
///@{
|
||||||
extern EFI_HII_HANDLE gHiiHandle;
|
extern EFI_HII_HANDLE gHiiHandle;
|
||||||
extern CHAR16 *mPrintTokenBuffer;
|
extern CHAR16 *mPrintTokenBuffer;
|
||||||
extern CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
|
extern CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
|
||||||
|
@ -36,7 +37,7 @@ extern PERF_CUM_DATA CumData[];
|
||||||
/// Number of items for which we are gathering cumulative statistics.
|
/// Number of items for which we are gathering cumulative statistics.
|
||||||
extern UINT32 const NumCum;
|
extern UINT32 const NumCum;
|
||||||
|
|
||||||
/// @}
|
///@}
|
||||||
|
|
||||||
/** Calculate an event's duration in timer ticks.
|
/** Calculate an event's duration in timer ticks.
|
||||||
*
|
*
|
||||||
|
@ -287,3 +288,4 @@ DumpRawProfile(
|
||||||
IN UINTN Limit,
|
IN UINTN Limit,
|
||||||
IN BOOLEAN ExcludeFlag
|
IN BOOLEAN ExcludeFlag
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
|
|
|
@ -29,22 +29,23 @@
|
||||||
#include "Literals.h"
|
#include "Literals.h"
|
||||||
#include "DpInternal.h"
|
#include "DpInternal.h"
|
||||||
|
|
||||||
/** Gather and print ALL Profiling Records.
|
/**
|
||||||
*
|
Gather and print ALL Profiling Records.
|
||||||
* Displays all "interesting" Profile measurements in order.
|
|
||||||
* The number of records displayed is controlled by:
|
Displays all "interesting" Profile measurements in order.
|
||||||
* - 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
|
||||||
DumpAllProfile(
|
DumpAllProfile(
|
||||||
|
@ -60,22 +61,23 @@ DumpAllProfile(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather and print Raw Profile Records.
|
/**
|
||||||
*
|
Gather and print Raw Profile Records.
|
||||||
* All Profile measurements with a duration greater than or equal to
|
|
||||||
* mInterestThreshold are printed without interpretation.
|
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.
|
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
|
||||||
DumpRawProfile(
|
DumpRawProfile(
|
||||||
|
|
|
@ -29,18 +29,19 @@
|
||||||
#include "Literals.h"
|
#include "Literals.h"
|
||||||
#include "DpInternal.h"
|
#include "DpInternal.h"
|
||||||
|
|
||||||
/** 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(
|
||||||
|
@ -99,22 +100,23 @@ GatherStatistics(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather and print ALL Trace Records.
|
/**
|
||||||
*
|
Gather and print ALL Trace Records.
|
||||||
* Displays all "interesting" Trace measurements in order.<BR>
|
|
||||||
* 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(
|
||||||
|
@ -230,22 +232,23 @@ DumpAllTrace(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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(
|
||||||
|
@ -305,10 +308,11 @@ DumpRawTrace(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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(
|
||||||
|
@ -316,18 +320,24 @@ ProcessPhases(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MEASUREMENT_RECORD Measurement;
|
MEASUREMENT_RECORD Measurement;
|
||||||
UINT64 BdsTimeoutValue = 0;
|
UINT64 BdsTimeoutValue;
|
||||||
UINT64 SecTime = 0;
|
UINT64 SecTime;
|
||||||
UINT64 PeiTime = 0;
|
UINT64 PeiTime;
|
||||||
UINT64 DxeTime = 0;
|
UINT64 DxeTime;
|
||||||
UINT64 BdsTime = 0;
|
UINT64 BdsTime;
|
||||||
UINT64 ShellTime = 0;
|
UINT64 ShellTime;
|
||||||
UINT64 ElapsedTime;
|
UINT64 ElapsedTime;
|
||||||
UINT64 Duration;
|
UINT64 Duration;
|
||||||
UINT64 Total;
|
UINT64 Total;
|
||||||
EFI_STRING StringPtr;
|
EFI_STRING StringPtr;
|
||||||
UINTN LogEntryKey;
|
UINTN LogEntryKey;
|
||||||
|
|
||||||
|
BdsTimeoutValue = 0;
|
||||||
|
SecTime = 0;
|
||||||
|
PeiTime = 0;
|
||||||
|
DxeTime = 0;
|
||||||
|
BdsTime = 0;
|
||||||
|
ShellTime = 0;
|
||||||
//
|
//
|
||||||
// Get Execution Phase Statistics
|
// Get Execution Phase Statistics
|
||||||
//
|
//
|
||||||
|
@ -434,11 +444,12 @@ ProcessPhases(
|
||||||
PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);
|
PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather and print Handle data.
|
/**
|
||||||
*
|
Gather and print Handle data.
|
||||||
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
|
||||||
*
|
@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(
|
||||||
|
@ -534,10 +545,11 @@ ProcessHandles(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather and print PEIM data.
|
/**
|
||||||
*
|
Gather and print PEIM data.
|
||||||
* Only prints complete PEIM records
|
|
||||||
*
|
Only prints complete PEIM records
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ProcessPeims(
|
ProcessPeims(
|
||||||
|
@ -589,14 +601,14 @@ ProcessPeims(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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(
|
||||||
|
@ -651,20 +663,21 @@ ProcessGlobal(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather and print cumulative data.
|
/**
|
||||||
*
|
Gather and print cumulative data.
|
||||||
* Traverse the measurement records and:<BR>
|
|
||||||
* For each record with a Token listed in the CumData array:<BR>
|
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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 avgval; // the computed average duration
|
UINT64 Avgval; // the computed average duration
|
||||||
EFI_STRING StringPtr;
|
EFI_STRING StringPtr;
|
||||||
UINTN TIndex;
|
UINTN TIndex;
|
||||||
|
|
||||||
|
@ -678,12 +691,12 @@ ProcessCumulative(
|
||||||
PrintToken (STRING_TOKEN (STR_DP_DASHES));
|
PrintToken (STRING_TOKEN (STR_DP_DASHES));
|
||||||
|
|
||||||
for ( TIndex = 0; TIndex < NumCum; ++TIndex) {
|
for ( TIndex = 0; TIndex < NumCum; ++TIndex) {
|
||||||
avgval = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
|
Avgval = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
|
||||||
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
|
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
|
||||||
CumData[TIndex].Name,
|
CumData[TIndex].Name,
|
||||||
CumData[TIndex].Count,
|
CumData[TIndex].Count,
|
||||||
DurationInMicroSeconds(CumData[TIndex].Duration),
|
DurationInMicroSeconds(CumData[TIndex].Duration),
|
||||||
DurationInMicroSeconds(avgval),
|
DurationInMicroSeconds(Avgval),
|
||||||
DurationInMicroSeconds(CumData[TIndex].MinDur),
|
DurationInMicroSeconds(CumData[TIndex].MinDur),
|
||||||
DurationInMicroSeconds(CumData[TIndex].MaxDur)
|
DurationInMicroSeconds(CumData[TIndex].MaxDur)
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,27 +31,25 @@
|
||||||
#include "Literals.h"
|
#include "Literals.h"
|
||||||
#include "DpInternal.h"
|
#include "DpInternal.h"
|
||||||
|
|
||||||
/** 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. Information for
|
Given the count direction and the event's start and end timer values,
|
||||||
* the current measurement is pointed to by the parameter.
|
calculate the duration of the event in timer ticks. Information for
|
||||||
*
|
the current measurement is pointed to by the parameter.
|
||||||
* If the measurement's start time is 1, it indicates that the developer
|
|
||||||
* is indicating that the measurement began at the release of reset.
|
If the measurement's start time is 1, it indicates that the developer
|
||||||
* The start time is adjusted to the timer's starting count before performing
|
is indicating that the measurement began at the release of reset.
|
||||||
* the elapsed time calculation.
|
The start time is adjusted to the timer's starting count before performing
|
||||||
*
|
the elapsed time calculation.
|
||||||
* The calculated duration, in ticks, is the absolute difference between
|
|
||||||
* the measurement's ending and starting counts.
|
The calculated duration, in ticks, is the absolute difference between
|
||||||
*
|
the measurement's ending and starting counts.
|
||||||
* @pre The global TimerInfo structure must have already been initialized
|
|
||||||
* before this function is called.
|
@param Measurement Pointer to a MEASUREMENT_RECORD structure containing
|
||||||
*
|
data for the current measurement.
|
||||||
* @param[in,out] Measurement Pointer to a MEASUREMENT_RECORD structure containing
|
|
||||||
* data for the current measurement.
|
@return The 64-bit duration of the event.
|
||||||
*
|
|
||||||
* @return The 64-bit duration of the event.
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
GetDuration (
|
GetDuration (
|
||||||
|
@ -85,15 +83,16 @@ GetDuration (
|
||||||
return Duration;
|
return Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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, BDS, or SHELL.
|
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(
|
||||||
|
@ -111,16 +110,17 @@ IsPhase(
|
||||||
return RetVal;
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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 (
|
||||||
|
@ -163,13 +163,14 @@ GetShortPdbFileName (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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 (
|
||||||
|
@ -227,17 +228,18 @@ GetNameFromHandle (
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculate the Duration in microseconds.
|
/**
|
||||||
*
|
Calculate the Duration in microseconds.
|
||||||
* Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
|
|
||||||
* multiplying the result 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.
|
||||||
* The time is calculated as (Duration * 1000) / Timer_Frequency.
|
|
||||||
*
|
The time is calculated as (Duration * 1000) / Timer_Frequency.
|
||||||
* @param[in] Duration The event duration in timer ticks.
|
|
||||||
*
|
@param[in] Duration The event duration in timer ticks.
|
||||||
* @return A 64-bit value which is the Elapsed time in microseconds.
|
|
||||||
|
@return A 64-bit value which is the Elapsed time in microseconds.
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
DurationInMicroSeconds (
|
DurationInMicroSeconds (
|
||||||
|
@ -250,12 +252,14 @@ DurationInMicroSeconds (
|
||||||
return DivU64x32 (Temp, TimerInfo.Frequency);
|
return DivU64x32 (Temp, TimerInfo.Frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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 (
|
||||||
|
@ -288,17 +292,18 @@ PrintToken (
|
||||||
return Return;
|
return Return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get index of Measurement Record's match in the CumData array.
|
/**
|
||||||
*
|
Get index of Measurement Record's match in the CumData array.
|
||||||
* If the Measurement's Token value matches a Token in one of the CumData
|
|
||||||
* records, the index of the matching record is returned. The returned
|
If the Measurement's Token value matches a Token in one of the CumData
|
||||||
* index is a signed value so that negative values can indicate that
|
records, the index of the matching record is returned. The returned
|
||||||
* the Measurement didn't match any entry in the CumData array.
|
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.
|
|
||||||
*
|
@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.
|
@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(
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef _GENERIC_ICH_H_
|
#ifndef _GENERIC_ICH_H_
|
||||||
#define _GENERIC_ICH_H_
|
#define _GENERIC_ICH_H_
|
||||||
|
|
||||||
/** @defgroup GenericIchDefs Generic ICH Definitions.
|
/** GenericIchDefs Generic ICH Definitions.
|
||||||
|
|
||||||
Definitions beginning with "R_" are registers.
|
Definitions beginning with "R_" are registers.
|
||||||
Definitions beginning with "B_" are bits within registers.
|
Definitions beginning with "B_" are bits within registers.
|
||||||
|
@ -25,21 +25,21 @@ Definitions beginning with "V_" are meaningful values of bits within the registe
|
||||||
**/
|
**/
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/// @defgroup IchPciAddressing PCI Bus Address for ICH.
|
/// IchPciAddressing PCI Bus Address for ICH.
|
||||||
///@{
|
///@{
|
||||||
#define PCI_BUS_NUMBER_ICH 0x00 ///< ICH is on PCI Bus 0.
|
#define PCI_BUS_NUMBER_ICH 0x00 ///< ICH is on PCI Bus 0.
|
||||||
#define PCI_DEVICE_NUMBER_ICH_LPC 31 ///< ICH is Device 31.
|
#define PCI_DEVICE_NUMBER_ICH_LPC 31 ///< ICH is Device 31.
|
||||||
#define PCI_FUNCTION_NUMBER_ICH_LPC 0 ///< ICH is Function 0.
|
#define PCI_FUNCTION_NUMBER_ICH_LPC 0 ///< ICH is Function 0.
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/// @defgroup IchAcpiCntr Control for the ICH's ACPI Counter.
|
/// IchAcpiCntr Control for the ICH's ACPI Counter.
|
||||||
///@{
|
///@{
|
||||||
#define R_ICH_LPC_ACPI_BASE 0x40
|
#define R_ICH_LPC_ACPI_BASE 0x40
|
||||||
#define R_ICH_LPC_ACPI_CNT 0x44
|
#define R_ICH_LPC_ACPI_CNT 0x44
|
||||||
#define B_ICH_LPC_ACPI_CNT_ACPI_EN 0x80
|
#define B_ICH_LPC_ACPI_CNT_ACPI_EN 0x80
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/// @defgroup IchAcpiTimer The ICH's ACPI Timer.
|
/// IchAcpiTimer The ICH's ACPI Timer.
|
||||||
///@{
|
///@{
|
||||||
#define R_ACPI_PM1_TMR 0x08
|
#define R_ACPI_PM1_TMR 0x08
|
||||||
#define V_ACPI_TMR_FREQUENCY 3579545
|
#define V_ACPI_TMR_FREQUENCY 3579545
|
||||||
|
|
|
@ -39,10 +39,6 @@
|
||||||
|
|
||||||
STATIC UINT64 mTscFrequency;
|
STATIC UINT64 mTscFrequency;
|
||||||
|
|
||||||
#ifndef R_ICH_ACPI_PM1_TMR
|
|
||||||
#define R_ICH_ACPI_PM1_TMR R_ACPI_PM1_TMR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** The constructor function determines the actual TSC frequency.
|
/** The constructor function determines the actual TSC frequency.
|
||||||
|
|
||||||
The TSC counting frequency is determined by comparing how far it counts
|
The TSC counting frequency is determined by comparing how far it counts
|
||||||
|
@ -108,7 +104,6 @@ TscTimerLibConstructor (
|
||||||
@param[in] Delay A period of time to delay in ticks.
|
@param[in] Delay A period of time to delay in ticks.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
STATIC
|
|
||||||
VOID
|
VOID
|
||||||
InternalX86Delay (
|
InternalX86Delay (
|
||||||
IN UINT64 Delay
|
IN UINT64 Delay
|
||||||
|
|
Loading…
Reference in New Issue