TianoCore EDK2 master
Loading...
Searching...
No Matches
DpInternal.h File Reference

Go to the source code of this file.

Macros

#define DP_GAUGE_STRING_LENGTH   36
 

Functions

UINT64 GetDuration (IN OUT MEASUREMENT_RECORD *Measurement)
 
BOOLEAN IsPhase (IN MEASUREMENT_RECORD *Measurement)
 
BOOLEAN IsCorePerf (IN MEASUREMENT_RECORD *Measurement)
 
VOID DpGetShortPdbFileName (IN CHAR8 *PdbFileName, OUT CHAR16 *UnicodeBuffer)
 
VOID DpGetNameFromHandle (IN EFI_HANDLE Handle)
 
UINT64 DurationInMicroSeconds (IN UINT64 Duration)
 
INTN GetCumulativeItem (IN MEASUREMENT_RECORD *Measurement)
 
VOID GatherStatistics (IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL)
 
EFI_STATUS DumpAllTrace (IN UINTN Limit, IN BOOLEAN ExcludeFlag)
 
EFI_STATUS DumpRawTrace (IN UINTN Limit, IN BOOLEAN ExcludeFlag)
 
VOID ProcessPhases (VOID)
 
EFI_STATUS ProcessHandles (IN BOOLEAN ExcludeFlag)
 
EFI_STATUS ProcessPeims (VOID)
 
EFI_STATUS ProcessGlobal (VOID)
 
VOID ProcessCumulative (IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL)
 

Variables

EFI_HII_HANDLE mDpHiiHandle
 
CHAR16 mGaugeString [DP_GAUGE_STRING_LENGTH+1]
 
CHAR16 mUnicodeToken [DXE_PERFORMANCE_STRING_SIZE]
 
UINT64 mInterestThreshold
 
BOOLEAN mShowId
 
UINT8 * mBootPerformanceTable
 
UINTN mBootPerformanceTableLength
 
MEASUREMENT_RECORDmMeasurementList
 
UINTN mMeasurementNum
 
UINT64 mResetEnd
 
PERF_SUMMARY_DATA SummaryData
 Create the SummaryData structure and init. to ZERO.
 
PERF_CUM_DATA CumData []
 Items for which to gather cumulative statistics.
 
UINT32 const NumCum
 Number of items for which we are gathering cumulative statistics.
 

Detailed Description

Declarations of objects defined internally to the Dp Application.

Declarations of data and functions which are private to the Dp application. This file should never be referenced by anything other than components of the Dp application. In addition to global data, function declarations for DpUtilities.c, DpTrace.c, and DpProfile.c are included here.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DpInternal.h.

Macro Definition Documentation

◆ DP_GAUGE_STRING_LENGTH

#define DP_GAUGE_STRING_LENGTH   36

Definition at line 17 of file DpInternal.h.

Function Documentation

◆ DpGetNameFromHandle()

VOID DpGetNameFromHandle ( IN EFI_HANDLE  Handle)

Get a human readable name for an image handle. The following methods will be tried orderly:

  1. Image PDB
  2. ComponentName2 protocol
  3. FFS UI section
  4. Image GUID
  5. Image DevicePath
  6. Unknown Driver Name
Parameters
[in]Handle
Postcondition
The resulting Unicode name string is stored in the mGaugeString global array.

Definition at line 208 of file DpUtilities.c.

◆ DpGetShortPdbFileName()

VOID DpGetShortPdbFileName ( IN CHAR8 *  PdbFileName,
OUT CHAR16 *  UnicodeBuffer 
)

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.

Parameters
[in]PdbFileNamePdb file name.
[out]UnicodeBufferThe resultant Unicode File Name.

Definition at line 150 of file DpUtilities.c.

◆ DumpAllTrace()

EFI_STATUS DumpAllTrace ( IN UINTN  Limit,
IN BOOLEAN  ExcludeFlag 
)

Gather and print ALL Trace Records.

Displays all "interesting" Trace 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.
Precondition
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.
Parameters
[in]LimitThe number of records to print. Zero is ALL.
[in]ExcludeFlagTRUE to exclude individual Cumulative items from display.
Return values
EFI_SUCCESSThe operation was successful.
EFI_ABORTEDThe user aborts the operation.
Returns
Others from a call to gBS->LocateHandleBuffer().

Definition at line 188 of file DpTrace.c.

◆ DumpRawTrace()

EFI_STATUS DumpRawTrace ( IN UINTN  Limit,
IN BOOLEAN  ExcludeFlag 
)

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.
Precondition
The mInterestThreshold global variable is set to the shortest duration to be printed.
Parameters
[in]LimitThe number of records to print. Zero is ALL.
[in]ExcludeFlagTRUE to exclude individual Cumulative items from display.
Return values
EFI_SUCCESSThe operation was successful.
EFI_ABORTEDThe user aborts the operation.

Definition at line 363 of file DpTrace.c.

◆ DurationInMicroSeconds()

UINT64 DurationInMicroSeconds ( IN UINT64  Duration)

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.

Parameters
[in]DurationThe event duration in timer ticks.
Returns
A 64-bit value which is the Elapsed time in microseconds.

Definition at line 392 of file DpUtilities.c.

◆ GatherStatistics()

VOID GatherStatistics ( IN OUT PERF_CUM_DATA *CustomCumulativeData  OPTIONAL)

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.

Precondition
The SummaryData and CumData structures must be initialized prior to calling this function.
Postcondition
The SummaryData and CumData structures contain statistics for the current performance logs.
Parameters
[in,out]CustomCumulativeDataThe pointer to the custom cumulative data.

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.

Precondition
The SummaryData and CumData structures must be initialized prior to calling this function.
Postcondition
The SummaryData and CumData structures contain statistics for the current performance logs.
Parameters
[in,out]CustomCumulativeDataA pointer to the custom cumulative data.

Definition at line 92 of file DpTrace.c.

◆ GetCumulativeItem()

INTN GetCumulativeItem ( IN MEASUREMENT_RECORD Measurement)

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.

Parameters
[in]MeasurementA pointer to a Measurement Record to match against the CumData array.
Return values
<0Token is not in the CumData array.
>=0Return value is the index into CumData where Token is found.

Definition at line 413 of file DpUtilities.c.

◆ GetDuration()

UINT64 GetDuration ( IN OUT MEASUREMENT_RECORD Measurement)

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.

Parameters
MeasurementPointer to a MEASUREMENT_RECORD structure containing data for the current measurement.
Returns
The 64-bit duration of the event.

Definition at line 57 of file DpUtilities.c.

◆ IsCorePerf()

BOOLEAN IsCorePerf ( IN MEASUREMENT_RECORD Measurement)

Determine whether the Measurement record is for core code.

Parameters
[in]MeasurementA pointer to the Measurement record to test.
Return values
TRUEThe measurement record is used for core.
FALSEThe measurement record is NOT used for core.

Definition at line 116 of file DpUtilities.c.

◆ IsPhase()

BOOLEAN IsPhase ( IN MEASUREMENT_RECORD Measurement)

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.

Parameters
[in]MeasurementA pointer to the Measurement record to test.
Return values
TRUEThe measurement record is for an EFI Phase.
FALSEThe measurement record is NOT for an EFI Phase.

Definition at line 91 of file DpUtilities.c.

◆ ProcessCumulative()

VOID ProcessCumulative ( IN PERF_CUM_DATA *CustomCumulativeData  OPTIONAL)

Gather and print cumulative data.

Traverse the measurement records and:
For each record with a Token listed in the CumData array:

  • Update the instance count and the total, minimum, and maximum durations. Finally, print the gathered cumulative statistics.
Parameters
[in]CustomCumulativeDataThe pointer to the custom cumulative data.

Gather and print cumulative data.

Traverse the measurement records and:
For each record with a Token listed in the CumData array:

  • Update the instance count and the total, minimum, and maximum durations. Finally, print the gathered cumulative statistics.
Parameters
[in]CustomCumulativeDataA pointer to the custom cumulative data.

Definition at line 966 of file DpTrace.c.

◆ ProcessGlobal()

EFI_STATUS ProcessGlobal ( VOID  )

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.

Return values
EFI_SUCCESSThe operation was successful.
EFI_ABORTEDThe user aborts the operation.

Definition at line 853 of file DpTrace.c.

◆ ProcessHandles()

EFI_STATUS ProcessHandles ( IN BOOLEAN  ExcludeFlag)

Gather and print Handle data.

Parameters
[in]ExcludeFlagTRUE to exclude individual Cumulative items from display.
Return values
EFI_SUCCESSThe operation was successful.
EFI_ABORTEDThe user aborts the operation.
Returns
Others from a call to gBS->LocateHandleBuffer().

Definition at line 610 of file DpTrace.c.

◆ ProcessPeims()

EFI_STATUS ProcessPeims ( VOID  )

Gather and print PEIM data.

Only prints complete PEIM records

Return values
EFI_SUCCESSThe operation was successful.
EFI_ABORTEDThe user aborts the operation.

Definition at line 747 of file DpTrace.c.

◆ ProcessPhases()

VOID ProcessPhases ( VOID  )

Gather and print Major Phase metrics.

Definition at line 478 of file DpTrace.c.

Variable Documentation

◆ CumData

PERF_CUM_DATA CumData[]
extern

Items for which to gather cumulative statistics.

Definition at line 67 of file Dp.c.

◆ mBootPerformanceTable

UINT8* mBootPerformanceTable
extern

Definition at line 56 of file Dp.c.

◆ mDpHiiHandle

EFI_HII_HANDLE mDpHiiHandle
extern

Module-Global Variables

Definition at line 39 of file Dp.c.

◆ mGaugeString

CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH+1]
extern

Module-Global Variables

Definition at line 52 of file Dp.c.

◆ mInterestThreshold

UINT64 mInterestThreshold
extern

Definition at line 54 of file Dp.c.

◆ mMeasurementList

MEASUREMENT_RECORD* mMeasurementList
extern

Definition at line 63 of file Dp.c.

◆ mMeasurementNum

UINTN mMeasurementNum
extern

Definition at line 64 of file Dp.c.

◆ mResetEnd

UINT64 mResetEnd
extern

Definition at line 60 of file Dp.c.

◆ mShowId

BOOLEAN mShowId
extern

Definition at line 55 of file Dp.c.

◆ mUnicodeToken

CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE]
extern

Definition at line 53 of file Dp.c.

◆ NumCum

UINT32 const NumCum
extern

Number of items for which we are gathering cumulative statistics.

Definition at line 76 of file Dp.c.

◆ SummaryData

PERF_SUMMARY_DATA SummaryData
extern

Create the SummaryData structure and init. to ZERO.

Definition at line 62 of file Dp.c.