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
|
@ -85,7 +85,9 @@ SHELL_PARAM_ITEM DpParamList[] = {
|
|||
|
||||
///@}
|
||||
|
||||
/// Display Usage and Help information.
|
||||
/**
|
||||
Display Usage and Help information.
|
||||
**/
|
||||
VOID
|
||||
ShowHelp( void )
|
||||
{
|
||||
|
@ -111,7 +113,9 @@ ShowHelp( void )
|
|||
Print(L"\n");
|
||||
}
|
||||
|
||||
/// Display the trailing Verbose information.
|
||||
/**
|
||||
Display the trailing Verbose information.
|
||||
**/
|
||||
VOID
|
||||
DumpStatistics( void )
|
||||
{
|
||||
|
@ -132,15 +136,16 @@ DumpStatistics( void )
|
|||
#endif // PROFILING_IMPLEMENTED
|
||||
}
|
||||
|
||||
/** Dump performance data.
|
||||
*
|
||||
* @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 value Unknown error.
|
||||
*
|
||||
/**
|
||||
Dump performance data.
|
||||
|
||||
@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 value Unknown error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -158,15 +163,21 @@ InitializeDp (
|
|||
UINTN Number2Display;
|
||||
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN SummaryMode = FALSE;
|
||||
BOOLEAN VerboseMode = FALSE;
|
||||
BOOLEAN AllMode = FALSE;
|
||||
BOOLEAN RawMode = FALSE;
|
||||
BOOLEAN TraceMode = FALSE;
|
||||
BOOLEAN ProfileMode = FALSE;
|
||||
BOOLEAN ExcludeMode = FALSE;
|
||||
|
||||
BOOLEAN SummaryMode;
|
||||
BOOLEAN VerboseMode;
|
||||
BOOLEAN AllMode;
|
||||
BOOLEAN RawMode;
|
||||
BOOLEAN TraceMode;
|
||||
BOOLEAN ProfileMode;
|
||||
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.
|
||||
// This is used as the Shell-Phase end time.
|
||||
//
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#ifndef _DP_INTELNAL_H_
|
||||
#define _DP_INTELNAL_H_
|
||||
//
|
||||
/// Module-Global Variables
|
||||
///@{
|
||||
|
@ -287,3 +288,4 @@ DumpRawProfile(
|
|||
IN UINTN Limit,
|
||||
IN BOOLEAN ExcludeFlag
|
||||
);
|
||||
#endif
|
||||
|
|
|
@ -29,22 +29,23 @@
|
|||
#include "Literals.h"
|
||||
#include "DpInternal.h"
|
||||
|
||||
/** Gather and print ALL Profiling Records.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
/**
|
||||
Gather and print ALL Profiling Records.
|
||||
|
||||
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
|
||||
DumpAllProfile(
|
||||
|
@ -60,22 +61,23 @@ DumpAllProfile(
|
|||
return;
|
||||
}
|
||||
|
||||
/** Gather and print Raw Profile Records.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
/**
|
||||
Gather and print Raw Profile Records.
|
||||
|
||||
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
|
||||
DumpRawProfile(
|
||||
|
|
|
@ -29,18 +29,19 @@
|
|||
#include "Literals.h"
|
||||
#include "DpInternal.h"
|
||||
|
||||
/** 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
|
||||
* 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.
|
||||
*
|
||||
* @post The SummaryData and CumData structures contain statistics for the
|
||||
* current performance logs.
|
||||
/**
|
||||
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
|
||||
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.
|
||||
|
||||
@post The SummaryData and CumData structures contain statistics for the
|
||||
current performance logs.
|
||||
**/
|
||||
VOID
|
||||
GatherStatistics(
|
||||
|
@ -99,22 +100,23 @@ GatherStatistics(
|
|||
}
|
||||
}
|
||||
|
||||
/** Gather and print ALL Trace Records.
|
||||
*
|
||||
* Displays all "interesting" Trace measurements in order.<BR>
|
||||
* 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.
|
||||
*
|
||||
/**
|
||||
Gather and print ALL Trace Records.
|
||||
|
||||
Displays all "interesting" Trace measurements in order.<BR>
|
||||
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
|
||||
DumpAllTrace(
|
||||
|
@ -230,22 +232,23 @@ DumpAllTrace(
|
|||
}
|
||||
}
|
||||
|
||||
/** Gather and print Raw Trace Records.
|
||||
*
|
||||
* 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.
|
||||
* - 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.
|
||||
*
|
||||
/**
|
||||
Gather and print Raw Trace Records.
|
||||
|
||||
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.
|
||||
- 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
|
||||
DumpRawTrace(
|
||||
|
@ -305,10 +308,11 @@ DumpRawTrace(
|
|||
}
|
||||
}
|
||||
|
||||
/** Gather and print Major Phase metrics.
|
||||
*
|
||||
* @param[in] Ticker The timer value for the END of Shell phase
|
||||
*
|
||||
/**
|
||||
Gather and print Major Phase metrics.
|
||||
|
||||
@param[in] Ticker The timer value for the END of Shell phase
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessPhases(
|
||||
|
@ -316,18 +320,24 @@ ProcessPhases(
|
|||
)
|
||||
{
|
||||
MEASUREMENT_RECORD Measurement;
|
||||
UINT64 BdsTimeoutValue = 0;
|
||||
UINT64 SecTime = 0;
|
||||
UINT64 PeiTime = 0;
|
||||
UINT64 DxeTime = 0;
|
||||
UINT64 BdsTime = 0;
|
||||
UINT64 ShellTime = 0;
|
||||
UINT64 BdsTimeoutValue;
|
||||
UINT64 SecTime;
|
||||
UINT64 PeiTime;
|
||||
UINT64 DxeTime;
|
||||
UINT64 BdsTime;
|
||||
UINT64 ShellTime;
|
||||
UINT64 ElapsedTime;
|
||||
UINT64 Duration;
|
||||
UINT64 Total;
|
||||
EFI_STRING StringPtr;
|
||||
UINTN LogEntryKey;
|
||||
|
||||
BdsTimeoutValue = 0;
|
||||
SecTime = 0;
|
||||
PeiTime = 0;
|
||||
DxeTime = 0;
|
||||
BdsTime = 0;
|
||||
ShellTime = 0;
|
||||
//
|
||||
// Get Execution Phase Statistics
|
||||
//
|
||||
|
@ -434,11 +444,12 @@ ProcessPhases(
|
|||
PrintToken (STRING_TOKEN (STR_DP_TOTAL_DURATION), Total);
|
||||
}
|
||||
|
||||
/** Gather and print Handle data.
|
||||
*
|
||||
* @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
*
|
||||
* @return Status from a call to gBS->LocateHandle().
|
||||
/**
|
||||
Gather and print Handle data.
|
||||
|
||||
@param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
||||
|
||||
@return Status from a call to gBS->LocateHandle().
|
||||
**/
|
||||
EFI_STATUS
|
||||
ProcessHandles(
|
||||
|
@ -534,10 +545,11 @@ ProcessHandles(
|
|||
return Status;
|
||||
}
|
||||
|
||||
/** Gather and print PEIM data.
|
||||
*
|
||||
* Only prints complete PEIM records
|
||||
*
|
||||
/**
|
||||
Gather and print PEIM data.
|
||||
|
||||
Only prints complete PEIM records
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessPeims(
|
||||
|
@ -589,14 +601,14 @@ ProcessPeims(
|
|||
}
|
||||
}
|
||||
|
||||
/** Gather and print global data.
|
||||
*
|
||||
* Strips out incomplete or "Execution Phase" records
|
||||
* Only prints records where Handle is NULL
|
||||
* Increment TIndex for every record, even skipped ones, so that we have an
|
||||
* indication of every measurement record taken.
|
||||
*
|
||||
*
|
||||
/**
|
||||
Gather and print global data.
|
||||
|
||||
Strips out incomplete or "Execution Phase" records
|
||||
Only prints records where Handle is NULL
|
||||
Increment TIndex for every record, even skipped ones, so that we have an
|
||||
indication of every measurement record taken.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessGlobal(
|
||||
|
@ -651,20 +663,21 @@ ProcessGlobal(
|
|||
}
|
||||
}
|
||||
|
||||
/** Gather and print cumulative data.
|
||||
*
|
||||
* Traverse the measurement records and:<BR>
|
||||
* For each record with a Token listed in the CumData array:<BR>
|
||||
* - Update the instance count and the total, minimum, and maximum durations.
|
||||
* Finally, print the gathered cumulative statistics.
|
||||
*
|
||||
/**
|
||||
Gather and print cumulative data.
|
||||
|
||||
Traverse the measurement records and:<BR>
|
||||
For each record with a Token listed in the CumData array:<BR>
|
||||
- Update the instance count and the total, minimum, and maximum durations.
|
||||
Finally, print the gathered cumulative statistics.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ProcessCumulative(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT64 avgval; // the computed average duration
|
||||
UINT64 Avgval; // the computed average duration
|
||||
EFI_STRING StringPtr;
|
||||
UINTN TIndex;
|
||||
|
||||
|
@ -678,12 +691,12 @@ ProcessCumulative(
|
|||
PrintToken (STRING_TOKEN (STR_DP_DASHES));
|
||||
|
||||
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),
|
||||
CumData[TIndex].Name,
|
||||
CumData[TIndex].Count,
|
||||
DurationInMicroSeconds(CumData[TIndex].Duration),
|
||||
DurationInMicroSeconds(avgval),
|
||||
DurationInMicroSeconds(Avgval),
|
||||
DurationInMicroSeconds(CumData[TIndex].MinDur),
|
||||
DurationInMicroSeconds(CumData[TIndex].MaxDur)
|
||||
);
|
||||
|
|
|
@ -31,27 +31,25 @@
|
|||
#include "Literals.h"
|
||||
#include "DpInternal.h"
|
||||
|
||||
/** 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
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @pre The global TimerInfo structure must have already been initialized
|
||||
* before this function is called.
|
||||
*
|
||||
* @param[in,out] Measurement Pointer to a MEASUREMENT_RECORD structure containing
|
||||
* data for the current measurement.
|
||||
*
|
||||
* @return The 64-bit duration of the event.
|
||||
/**
|
||||
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
|
||||
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.
|
||||
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.
|
||||
|
||||
@param Measurement Pointer to a MEASUREMENT_RECORD structure containing
|
||||
data for the current measurement.
|
||||
|
||||
@return The 64-bit duration of the event.
|
||||
**/
|
||||
UINT64
|
||||
GetDuration (
|
||||
|
@ -85,15 +83,16 @@ GetDuration (
|
|||
return Duration;
|
||||
}
|
||||
|
||||
/** 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.
|
||||
*
|
||||
* @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.
|
||||
/**
|
||||
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.
|
||||
|
||||
@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.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsPhase(
|
||||
|
@ -111,16 +110,17 @@ IsPhase(
|
|||
return RetVal;
|
||||
}
|
||||
|
||||
/** 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
|
||||
* 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.
|
||||
*
|
||||
/**
|
||||
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
|
||||
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.
|
||||
|
||||
**/
|
||||
VOID
|
||||
GetShortPdbFileName (
|
||||
|
@ -163,13 +163,14 @@ GetShortPdbFileName (
|
|||
}
|
||||
}
|
||||
|
||||
/** Get a human readable name for an image handle.
|
||||
*
|
||||
* @param[in] Handle
|
||||
*
|
||||
* @post The resulting Unicode name string is stored in the
|
||||
* mGaugeString global array.
|
||||
*
|
||||
/**
|
||||
Get a human readable name for an image handle.
|
||||
|
||||
@param[in] Handle
|
||||
|
||||
@post The resulting Unicode name string is stored in the
|
||||
mGaugeString global array.
|
||||
|
||||
**/
|
||||
VOID
|
||||
GetNameFromHandle (
|
||||
|
@ -227,17 +228,18 @@ GetNameFromHandle (
|
|||
return ;
|
||||
}
|
||||
|
||||
/** 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
|
||||
* a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
|
||||
*
|
||||
* The time is calculated as (Duration * 1000) / Timer_Frequency.
|
||||
*
|
||||
* @param[in] Duration The event duration in timer ticks.
|
||||
*
|
||||
* @return A 64-bit value which is the Elapsed time 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
|
||||
a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
|
||||
|
||||
The time is calculated as (Duration * 1000) / Timer_Frequency.
|
||||
|
||||
@param[in] Duration The event duration in timer ticks.
|
||||
|
||||
@return A 64-bit value which is the Elapsed time in microseconds.
|
||||
**/
|
||||
UINT64
|
||||
DurationInMicroSeconds (
|
||||
|
@ -250,12 +252,14 @@ DurationInMicroSeconds (
|
|||
return DivU64x32 (Temp, TimerInfo.Frequency);
|
||||
}
|
||||
|
||||
/** Formatted Print using a Hii Token to reference the localized format string.
|
||||
*
|
||||
* @param[in] Token A HII token associated with a localized Unicode string.
|
||||
*
|
||||
* @return The number of characters converted by UnicodeVSPrint().
|
||||
*
|
||||
/**
|
||||
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] ... The variable argument list.
|
||||
|
||||
@return The number of characters converted by UnicodeVSPrint().
|
||||
|
||||
**/
|
||||
UINTN
|
||||
PrintToken (
|
||||
|
@ -288,17 +292,18 @@ PrintToken (
|
|||
return Return;
|
||||
}
|
||||
|
||||
/** 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
|
||||
* 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.
|
||||
/**
|
||||
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
|
||||
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
|
||||
GetCumulativeItem(
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _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 "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_DEVICE_NUMBER_ICH_LPC 31 ///< ICH is Device 31.
|
||||
#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_CNT 0x44
|
||||
#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 V_ACPI_TMR_FREQUENCY 3579545
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
|
||||
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 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.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
InternalX86Delay (
|
||||
IN UINT64 Delay
|
||||
|
|
Loading…
Reference in New Issue