TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeCorePerformanceLib.c File Reference

Go to the source code of this file.

Data Structures

struct  HANDLE_GUID_MAP
 

Macros

#define SMM_BOOT_RECORD_COMM_SIZE   (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
 
#define STRING_SIZE   (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
 
#define FIRMWARE_RECORD_BUFFER   0x10000
 
#define CACHE_HANDLE_GUID_COUNT   0x800
 

Functions

EFI_STATUS GetFpdtRecordPtr (IN UINT8 RecordSize, IN OUT FPDT_RECORD_PTR *FpdtRecordPtr)
 
BOOLEAN IsKnownTokens (IN CONST CHAR8 *Token)
 
BOOLEAN IsKnownID (IN UINT32 Identifier)
 
VOID InternalGetSmmPerfData (OUT VOID **SmmPerfData, OUT UINTN *SmmPerfDataSize, IN BOOLEAN SkipGetPerfData)
 
EFI_STATUS AllocateBootPerformanceTable (VOID)
 
EFI_STATUS GetModuleInfoFromHandle (IN EFI_HANDLE Handle, OUT CHAR8 *NameString, IN UINTN BufferSize, OUT EFI_GUID *ModuleGuid OPTIONAL)
 
EFI_STATUS GetFpdtRecordId (IN PERF_MEASUREMENT_ATTRIBUTE Attribute, IN CONST VOID *Handle, IN CONST CHAR8 *String, OUT UINT16 *ProgressID)
 
VOID CopyStringIntoPerfRecordAndUpdateLength (IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
 
EFI_STATUS GetDeviceInfoFromHandleAndUpdateLength (IN CONST VOID *Handle, IN EFI_HANDLE ControllerHandle, OUT CHAR8 *ComponentNameString, IN OUT UINT8 *Length)
 
EFI_STATUS InsertFpdtRecord (IN CONST VOID *CallerIdentifier OPTIONAL, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Ticker, IN UINT64 Address OPTIONAL, IN UINT16 PerfId, IN PERF_MEASUREMENT_ATTRIBUTE Attribute)
 
VOID InternalGetPeiPerformance (VOID *HobStart)
 
VOID EFIAPI ReportFpdtRecordBuffer (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI UpdateBootPerformanceTable (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI DxeCorePerformanceLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI CreatePerformanceMeasurement (IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 TimeStamp, IN UINT64 Address OPTIONAL, IN UINT32 Identifier, IN PERF_MEASUREMENT_ATTRIBUTE Attribute)
 
RETURN_STATUS EFIAPI StartPerformanceMeasurementEx (IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp, IN UINT32 Identifier)
 
RETURN_STATUS EFIAPI EndPerformanceMeasurementEx (IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp, IN UINT32 Identifier)
 
UINTN EFIAPI GetPerformanceMeasurementEx (IN UINTN LogEntryKey, OUT CONST VOID **Handle, OUT CONST CHAR8 **Token, OUT CONST CHAR8 **Module, OUT UINT64 *StartTimeStamp, OUT UINT64 *EndTimeStamp, OUT UINT32 *Identifier)
 
RETURN_STATUS EFIAPI StartPerformanceMeasurement (IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp)
 
RETURN_STATUS EFIAPI EndPerformanceMeasurement (IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp)
 
UINTN EFIAPI GetPerformanceMeasurement (IN UINTN LogEntryKey, OUT CONST VOID **Handle, OUT CONST CHAR8 **Token, OUT CONST CHAR8 **Module, OUT UINT64 *StartTimeStamp, OUT UINT64 *EndTimeStamp)
 
BOOLEAN EFIAPI PerformanceMeasurementEnabled (VOID)
 
RETURN_STATUS EFIAPI LogPerformanceMeasurement (IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier)
 
BOOLEAN EFIAPI LogPerformanceMeasurementEnabled (IN CONST UINTN Type)
 

Variables

BOOT_PERFORMANCE_TABLEmAcpiBootPerformanceTable = NULL
 
BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate
 
HANDLE_GUID_MAP mCacheHandleGuidTable [CACHE_HANDLE_GUID_COUNT]
 
UINTN mCachePairCount = 0
 
UINT32 mLoadImageCount = 0
 
UINT32 mPerformanceLength = 0
 
UINT32 mMaxPerformanceLength = 0
 
UINT32 mBootRecordSize = 0
 
UINTN mBootRecordMaxSize = 0
 
UINT32 mCachedLength = 0
 
BOOLEAN mFpdtBufferIsReported = FALSE
 
BOOLEAN mLackSpaceIsReported = FALSE
 
CHAR8 * mPlatformLanguage = NULL
 
UINT8 * mPerformancePointer = NULL
 
UINT8 * mBootRecordBuffer = NULL
 
BOOLEAN mLockInsertRecord = FALSE
 
CHAR8 * mDevicePathString = NULL
 
UINTN mSmmBootRecordOffset = 0
 
EFI_DEVICE_PATH_TO_TEXT_PROTOCOLmDevicePathToText = NULL
 
EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface
 
PERFORMANCE_PROPERTY mPerformanceProperty
 

Detailed Description

Performance library instance mainly used by DxeCore.

This library provides the performance measurement interfaces and initializes performance logging for DXE phase. It first initializes its private global data structure for performance logging and saves the performance GUIDed HOB passed from PEI phase. It initializes DXE phase performance logging by publishing the Performance and PerformanceEx Protocol, which are consumed by DxePerformanceLib to logging performance data in DXE phase.

This library is mainly used by DxeCore to start performance logging to ensure that Performance Protocol is installed at the very beginning of DXE phase.

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

Definition in file DxeCorePerformanceLib.c.

Macro Definition Documentation

◆ CACHE_HANDLE_GUID_COUNT

#define CACHE_HANDLE_GUID_COUNT   0x800

Definition at line 27 of file DxeCorePerformanceLib.c.

◆ FIRMWARE_RECORD_BUFFER

#define FIRMWARE_RECORD_BUFFER   0x10000

Definition at line 26 of file DxeCorePerformanceLib.c.

◆ SMM_BOOT_RECORD_COMM_SIZE

#define SMM_BOOT_RECORD_COMM_SIZE   (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))

Definition at line 24 of file DxeCorePerformanceLib.c.

◆ STRING_SIZE

#define STRING_SIZE   (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))

Definition at line 25 of file DxeCorePerformanceLib.c.

Function Documentation

◆ AllocateBootPerformanceTable()

EFI_STATUS AllocateBootPerformanceTable ( VOID  )

Allocate buffer for Boot Performance table.

Returns
Status code.

Definition at line 343 of file DxeCorePerformanceLib.c.

◆ CopyStringIntoPerfRecordAndUpdateLength()

VOID CopyStringIntoPerfRecordAndUpdateLength ( IN OUT CHAR8 *  Destination,
IN CONST CHAR8 *  Source,
IN OUT UINT8 *  Length 
)

Copies the string from Source into Destination and updates Length with the size of the string.

Parameters
Destination- destination of the string copy
Source- pointer to the source string which will get copied
Length- pointer to a length variable to be updated

Definition at line 791 of file DxeCorePerformanceLib.c.

◆ CreatePerformanceMeasurement()

EFI_STATUS EFIAPI CreatePerformanceMeasurement ( IN CONST VOID *  CallerIdentifier,
IN CONST VOID *Guid  OPTIONAL,
IN CONST CHAR8 *String  OPTIONAL,
IN UINT64  TimeStamp,
IN UINT64 Address  OPTIONAL,
IN UINT32  Identifier,
IN PERF_MEASUREMENT_ATTRIBUTE  Attribute 
)

Create performance record with event description and a timestamp.

Parameters
CallerIdentifier- Image handle or pointer to caller ID GUID.
Guid- Pointer to a GUID.
String- Pointer to a string describing the measurement.
TimeStamp- 64-bit time stamp.
Address- Pointer to a location in memory relevant to the measurement.
Identifier- Performance identifier describing the type of measurement.
Attribute- The attribute of the measurement. According to attribute can create a start record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX, or a general record for other Perf macros.
Return values
EFI_SUCCESS- Successfully created performance record.
EFI_OUT_OF_RESOURCES- Ran out of space to store the records.
EFI_INVALID_PARAMETER- Invalid parameter passed to function - NULL pointer or invalid PerfId.

Definition at line 1581 of file DxeCorePerformanceLib.c.

◆ DxeCorePerformanceLibConstructor()

EFI_STATUS EFIAPI DxeCorePerformanceLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function initializes Performance infrastructure for DXE phase.

The constructor function publishes Performance and PerformanceEx protocol, allocates memory to log DXE performance and merges PEI performance data to DXE performance log. It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor always returns EFI_SUCCESS.

Definition at line 1482 of file DxeCorePerformanceLib.c.

◆ EndPerformanceMeasurement()

RETURN_STATUS EFIAPI EndPerformanceMeasurement ( IN CONST VOID *Handle  OPTIONAL,
IN CONST CHAR8 *Token  OPTIONAL,
IN CONST CHAR8 *Module  OPTIONAL,
IN UINT64  TimeStamp 
)

Searches the performance measurement log from the beginning of the log for the first matching record that contains a zero end time and fills in a valid end time.

Searches the performance measurement log from the beginning of the log for the first record that matches Handle, Token, and Module and has an end time value of zero. If the record can not be found then return RETURN_NOT_FOUND. If the record is found and TimeStamp is not zero, then the end time in the record is filled in with the value specified by TimeStamp. If the record is found and TimeStamp is zero, then the end time in the matching record is filled in with the current time stamp value.

Parameters
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
TimeStamp64-bit time stamp.
Return values
RETURN_SUCCESSThe end of the measurement was recorded.
RETURN_NOT_FOUNDThe specified measurement record could not be found.

Definition at line 1825 of file DxeCorePerformanceLib.c.

◆ EndPerformanceMeasurementEx()

RETURN_STATUS EFIAPI EndPerformanceMeasurementEx ( IN CONST VOID *Handle  OPTIONAL,
IN CONST CHAR8 *Token  OPTIONAL,
IN CONST CHAR8 *Module  OPTIONAL,
IN UINT64  TimeStamp,
IN UINT32  Identifier 
)

Searches the performance measurement log from the beginning of the log for the first matching record that contains a zero end time and fills in a valid end time.

Searches the performance measurement log from the beginning of the log for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero. If the record can not be found then return RETURN_NOT_FOUND. If the record is found and TimeStamp is not zero, then the end time in the record is filled in with the value specified by TimeStamp. If the record is found and TimeStamp is zero, then the end time in the matching record is filled in with the current time stamp value.

Parameters
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
TimeStamp64-bit time stamp.
Identifier32-bit identifier. If the value is 0, the found record is same as the one found by EndPerformanceMeasurement.
Return values
RETURN_SUCCESSThe end of the measurement was recorded.
RETURN_NOT_FOUNDThe specified measurement record could not be found.

Definition at line 1684 of file DxeCorePerformanceLib.c.

◆ GetDeviceInfoFromHandleAndUpdateLength()

EFI_STATUS GetDeviceInfoFromHandleAndUpdateLength ( IN CONST VOID *  Handle,
IN EFI_HANDLE  ControllerHandle,
OUT CHAR8 *  ComponentNameString,
IN OUT UINT8 *  Length 
)

Get a string description for device for the given controller handle and update record length. If ComponentName2 GetControllerName is supported, the value is included in the string, followed by device path, otherwise just device path.

Parameters
Handle- Image handle
ControllerHandle- Controller handle.
ComponentNameString- Pointer to a location where the string will be saved
Length- Pointer to record length to be updated
Return values
EFI_SUCCESS- Successfully got string description for device
EFI_UNSUPPORTED- Neither ComponentName2 ControllerName nor DevicePath were found

Definition at line 837 of file DxeCorePerformanceLib.c.

◆ GetFpdtRecordId()

EFI_STATUS GetFpdtRecordId ( IN PERF_MEASUREMENT_ATTRIBUTE  Attribute,
IN CONST VOID *  Handle,
IN CONST CHAR8 *  String,
OUT UINT16 *  ProgressID 
)

Get the FPDT record identifier.

Parameters
AttributeThe attribute of the Record. PerfStartEntry: Start Record. PerfEndEntry: End Record.
HandlePointer to environment specific context used to identify the component being measured.
StringPointer to a Null-terminated ASCII string that identifies the component being measured.
ProgressIDOn return, pointer to the ProgressID.
Return values
EFI_SUCCESSGet record info successfully.
EFI_INVALID_PARAMETERNo matched FPDT record.

Definition at line 696 of file DxeCorePerformanceLib.c.

◆ GetFpdtRecordPtr()

EFI_STATUS GetFpdtRecordPtr ( IN UINT8  RecordSize,
IN OUT FPDT_RECORD_PTR FpdtRecordPtr 
)

Return the pointer to the FPDT record in the allocated memory.

Parameters
RecordSizeThe size of FPDT record.
FpdtRecordPtrPointer the FPDT record in the allocated memory.
Return values
EFI_SUCCESSSuccessfully get the pointer to the FPDT record.
EFI_OUT_OF_RESOURCESRan out of space to store the records.

Definition at line 99 of file DxeCorePerformanceLib.c.

◆ GetModuleInfoFromHandle()

EFI_STATUS GetModuleInfoFromHandle ( IN EFI_HANDLE  Handle,
OUT CHAR8 *  NameString,
IN UINTN  BufferSize,
OUT EFI_GUID *ModuleGuid  OPTIONAL 
)

Get a human readable module name and module guid for the given image handle. If module name can't be found, "" string will return. If module guid can't be found, Zero Guid will return.

Parameters
HandleImage handle or Controller handle.
NameStringThe ascii string will be filled into it. If not found, null string will return.
BufferSizeSize of the input NameString buffer.
ModuleGuidPoint to the guid buffer to store the got module guid value.
Return values
EFI_SUCCESSSuccessfully get module name and guid.
EFI_INVALID_PARAMETERThe input parameter NameString is NULL.
othervalue Module Name can't be got.

Definition at line 455 of file DxeCorePerformanceLib.c.

◆ GetPerformanceMeasurement()

UINTN EFIAPI GetPerformanceMeasurement ( IN UINTN  LogEntryKey,
OUT CONST VOID **  Handle,
OUT CONST CHAR8 **  Token,
OUT CONST CHAR8 **  Module,
OUT UINT64 *  StartTimeStamp,
OUT UINT64 *  EndTimeStamp 
)

Attempts to retrieve a performance measurement log entry from the performance measurement log. It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx, and then eliminate the Identifier.

!!! Not support!!!

Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is zero on entry, then an attempt is made to retrieve the first entry from the performance log, and the key for the second entry in the log is returned. If the performance log is empty, then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is retrieved and an implementation specific non-zero key value that specifies the end of the performance log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry is retrieved and zero is returned. In the cases where a performance log entry can be returned, the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp. If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT(). If Handle is NULL, then ASSERT(). If Token is NULL, then ASSERT(). If Module is NULL, then ASSERT(). If StartTimeStamp is NULL, then ASSERT(). If EndTimeStamp is NULL, then ASSERT().

Parameters
LogEntryKeyOn entry, the key of the performance measurement log entry to retrieve. 0, then the first performance measurement log entry is retrieved. On exit, the key of the next performance log entry.
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
StartTimeStampPointer to the 64-bit time stamp that was recorded when the measurement was started.
EndTimeStampPointer to the 64-bit time stamp that was recorded when the measurement was ended.
Returns
The key for the next performance log entry (in general case).

Definition at line 1878 of file DxeCorePerformanceLib.c.

◆ GetPerformanceMeasurementEx()

UINTN EFIAPI GetPerformanceMeasurementEx ( IN UINTN  LogEntryKey,
OUT CONST VOID **  Handle,
OUT CONST CHAR8 **  Token,
OUT CONST CHAR8 **  Module,
OUT UINT64 *  StartTimeStamp,
OUT UINT64 *  EndTimeStamp,
OUT UINT32 *  Identifier 
)

Attempts to retrieve a performance measurement log entry from the performance measurement log. It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement, and then assign the Identifier with 0.

!!! Not support!!!

Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is zero on entry, then an attempt is made to retrieve the first entry from the performance log, and the key for the second entry in the log is returned. If the performance log is empty, then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is retrieved and an implementation specific non-zero key value that specifies the end of the performance log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry is retrieved and zero is returned. In the cases where a performance log entry can be returned, the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier. If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT(). If Handle is NULL, then ASSERT(). If Token is NULL, then ASSERT(). If Module is NULL, then ASSERT(). If StartTimeStamp is NULL, then ASSERT(). If EndTimeStamp is NULL, then ASSERT(). If Identifier is NULL, then ASSERT().

Parameters
LogEntryKeyOn entry, the key of the performance measurement log entry to retrieve. 0, then the first performance measurement log entry is retrieved. On exit, the key of the next performance log entry.
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
StartTimeStampPointer to the 64-bit time stamp that was recorded when the measurement was started.
EndTimeStampPointer to the 64-bit time stamp that was recorded when the measurement was ended.
IdentifierPointer to the 32-bit identifier that was recorded when the measurement was ended.
Returns
The key for the next performance log entry (in general case).

Definition at line 1751 of file DxeCorePerformanceLib.c.

◆ InsertFpdtRecord()

EFI_STATUS InsertFpdtRecord ( IN CONST VOID *CallerIdentifier  OPTIONAL,
IN CONST VOID *Guid  OPTIONAL,
IN CONST CHAR8 *String  OPTIONAL,
IN UINT64  Ticker,
IN UINT64 Address  OPTIONAL,
IN UINT16  PerfId,
IN PERF_MEASUREMENT_ATTRIBUTE  Attribute 
)

Create performance record with event description and a timestamp.

Parameters
CallerIdentifier- Image handle or pointer to caller ID GUID.
Guid- Pointer to a GUID.
String- Pointer to a string describing the measurement.
Ticker- 64-bit time stamp.
Address- Pointer to a location in memory relevant to the measurement.
PerfId- Performance identifier describing the type of measurement.
Attribute- The attribute of the measurement. According to attribute can create a start record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX, or a general record for other Perf macros.
Return values
EFI_SUCCESS- Successfully created performance record.
EFI_OUT_OF_RESOURCES- Ran out of space to store the records.
EFI_INVALID_PARAMETER- Invalid parameter passed to function - NULL pointer or invalid PerfId.
EFI_SUCCESS- Successfully created performance record
EFI_OUT_OF_RESOURCES- Ran out of space to store the records
EFI_INVALID_PARAMETER- Invalid parameter passed to function - NULL pointer or invalid PerfId

Definition at line 970 of file DxeCorePerformanceLib.c.

◆ InternalGetPeiPerformance()

VOID InternalGetPeiPerformance ( VOID *  HobStart)

Dumps all the PEI performance.

Parameters
HobStartA pointer to a Guid.

This internal function dumps all the PEI performance log to the DXE performance gauge array. It retrieves the optional GUID HOB for PEI performance and then saves the performance data to DXE performance data structures.

Definition at line 1339 of file DxeCorePerformanceLib.c.

◆ InternalGetSmmPerfData()

VOID InternalGetSmmPerfData ( OUT VOID **  SmmPerfData,
OUT UINTN SmmPerfDataSize,
IN BOOLEAN  SkipGetPerfData 
)

This internal function dumps all the SMM performance data and size.

Parameters
SmmPerfDataSmm Performance data. The buffer contain the SMM perf data is allocated by this function and caller needs to free it.
SmmPerfDataSizeSmm Performance data size.
SkipGetPerfDataSkip to get performance data, just get the size.

Definition at line 222 of file DxeCorePerformanceLib.c.

◆ IsKnownID()

BOOLEAN IsKnownID ( IN UINT32  Identifier)

Check whether the ID is a known one which map to the known Token.

Parameters
Identifier32-bit identifier.
Return values
TRUEIs a known one used by core.
FALSENot a known one.

Definition at line 192 of file DxeCorePerformanceLib.c.

◆ IsKnownTokens()

BOOLEAN IsKnownTokens ( IN CONST CHAR8 *  Token)

Check whether the Token is a known one which is uesed by core.

Parameters
TokenPointer to a Null-terminated ASCII string
Return values
TRUEIs a known one used by core.
FALSENot a known one.

Definition at line 157 of file DxeCorePerformanceLib.c.

◆ LogPerformanceMeasurement()

RETURN_STATUS EFIAPI LogPerformanceMeasurement ( IN CONST VOID *  CallerIdentifier,
IN CONST VOID *Guid  OPTIONAL,
IN CONST CHAR8 *String  OPTIONAL,
IN UINT64 Address  OPTIONAL,
IN UINT32  Identifier 
)

Create performance record with event description and a timestamp.

Parameters
CallerIdentifier- Image handle or pointer to caller ID GUID
Guid- Pointer to a GUID
String- Pointer to a string describing the measurement
Address- Pointer to a location in memory relevant to the measurement
Identifier- Performance identifier describing the type of measurement
Return values
RETURN_SUCCESS- Successfully created performance record
RETURN_OUT_OF_RESOURCES- Ran out of space to store the records
RETURN_INVALID_PARAMETER- Invalid parameter passed to function - NULL pointer or invalid PerfId

Definition at line 1928 of file DxeCorePerformanceLib.c.

◆ LogPerformanceMeasurementEnabled()

BOOLEAN EFIAPI LogPerformanceMeasurementEnabled ( IN CONST UINTN  Type)

Check whether the specified performance measurement can be logged.

This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.

Parameters
Type- Type of the performance measurement entry.
Return values
TRUEThe performance measurement can be logged.
FALSEThe performance measurement can NOT be logged.

Definition at line 1953 of file DxeCorePerformanceLib.c.

◆ PerformanceMeasurementEnabled()

BOOLEAN EFIAPI PerformanceMeasurementEnabled ( VOID  )

Returns TRUE if the performance measurement macros are enabled.

This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.

Return values
TRUEThe PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set.
FALSEThe PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is clear.

Definition at line 1904 of file DxeCorePerformanceLib.c.

◆ ReportFpdtRecordBuffer()

VOID EFIAPI ReportFpdtRecordBuffer ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Report Boot Perforamnce table address as report status code.

Parameters
EventThe event of notify protocol.
ContextNotify event context.

Definition at line 1391 of file DxeCorePerformanceLib.c.

◆ StartPerformanceMeasurement()

RETURN_STATUS EFIAPI StartPerformanceMeasurement ( IN CONST VOID *Handle  OPTIONAL,
IN CONST CHAR8 *Token  OPTIONAL,
IN CONST CHAR8 *Module  OPTIONAL,
IN UINT64  TimeStamp 
)

Adds a record at the end of the performance measurement log that records the start time of a performance measurement.

Adds a record to the end of the performance measurement log that contains the Handle, Token, and Module. The end time of the new record must be set to zero. If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. If TimeStamp is zero, the start time in the record is filled in with the value read from the current time stamp.

Parameters
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
TimeStamp64-bit time stamp.
Return values
RETURN_SUCCESSThe start of the measurement was recorded.
RETURN_OUT_OF_RESOURCESThere are not enough resources to record the measurement.

Definition at line 1789 of file DxeCorePerformanceLib.c.

◆ StartPerformanceMeasurementEx()

RETURN_STATUS EFIAPI StartPerformanceMeasurementEx ( IN CONST VOID *Handle  OPTIONAL,
IN CONST CHAR8 *Token  OPTIONAL,
IN CONST CHAR8 *Module  OPTIONAL,
IN UINT64  TimeStamp,
IN UINT32  Identifier 
)

Adds a record at the end of the performance measurement log that records the start time of a performance measurement.

Adds a record to the end of the performance measurement log that contains the Handle, Token, Module and Identifier. The end time of the new record must be set to zero. If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record. If TimeStamp is zero, the start time in the record is filled in with the value read from the current time stamp.

Parameters
HandlePointer to environment specific context used to identify the component being measured.
TokenPointer to a Null-terminated ASCII string that identifies the component being measured.
ModulePointer to a Null-terminated ASCII string that identifies the module being measured.
TimeStamp64-bit time stamp.
Identifier32-bit identifier. If the value is 0, the created record is same as the one created by StartPerformanceMeasurement.
Return values
RETURN_SUCCESSThe start of the measurement was recorded.
RETURN_OUT_OF_RESOURCESThere are not enough resources to record the measurement.

Definition at line 1635 of file DxeCorePerformanceLib.c.

◆ UpdateBootPerformanceTable()

VOID EFIAPI UpdateBootPerformanceTable ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Update Boot Performance table.

Parameters
EventThe event of notify protocol.
ContextNotify event context.

Definition at line 1432 of file DxeCorePerformanceLib.c.

Variable Documentation

◆ mAcpiBootPerformanceTable

BOOT_PERFORMANCE_TABLE* mAcpiBootPerformanceTable = NULL

Definition at line 29 of file DxeCorePerformanceLib.c.

◆ mBootPerformanceTableTemplate

BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate
Initial value:
= {
{
},
{
{
EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_FIRMWARE_BASIC_BOOT,
EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_FIRMWARE_BASIC_BOOT
},
0,
0,
0,
0,
0,
0
}
}
#define EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE
Definition: Acpi50.h:1225

Definition at line 30 of file DxeCorePerformanceLib.c.

◆ mBootRecordBuffer

UINT8* mBootRecordBuffer = NULL

Definition at line 73 of file DxeCorePerformanceLib.c.

◆ mBootRecordMaxSize

UINTN mBootRecordMaxSize = 0

Definition at line 66 of file DxeCorePerformanceLib.c.

◆ mBootRecordSize

UINT32 mBootRecordSize = 0

Definition at line 65 of file DxeCorePerformanceLib.c.

◆ mCachedLength

UINT32 mCachedLength = 0

Definition at line 67 of file DxeCorePerformanceLib.c.

◆ mCacheHandleGuidTable

HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT]

Definition at line 59 of file DxeCorePerformanceLib.c.

◆ mCachePairCount

UINTN mCachePairCount = 0

Definition at line 60 of file DxeCorePerformanceLib.c.

◆ mDevicePathString

CHAR8* mDevicePathString = NULL

Definition at line 75 of file DxeCorePerformanceLib.c.

◆ mDevicePathToText

EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* mDevicePathToText = NULL

Definition at line 78 of file DxeCorePerformanceLib.c.

◆ mFpdtBufferIsReported

BOOLEAN mFpdtBufferIsReported = FALSE

Definition at line 69 of file DxeCorePerformanceLib.c.

◆ mLackSpaceIsReported

BOOLEAN mLackSpaceIsReported = FALSE

Definition at line 70 of file DxeCorePerformanceLib.c.

◆ mLoadImageCount

UINT32 mLoadImageCount = 0

Definition at line 62 of file DxeCorePerformanceLib.c.

◆ mLockInsertRecord

BOOLEAN mLockInsertRecord = FALSE

Definition at line 74 of file DxeCorePerformanceLib.c.

◆ mMaxPerformanceLength

UINT32 mMaxPerformanceLength = 0

Definition at line 64 of file DxeCorePerformanceLib.c.

◆ mPerformanceLength

UINT32 mPerformanceLength = 0

Definition at line 63 of file DxeCorePerformanceLib.c.

◆ mPerformanceMeasurementInterface

EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface
Initial value:
= {
}
EFI_STATUS EFIAPI CreatePerformanceMeasurement(IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 TimeStamp, IN UINT64 Address OPTIONAL, IN UINT32 Identifier, IN PERF_MEASUREMENT_ATTRIBUTE Attribute)

Definition at line 83 of file DxeCorePerformanceLib.c.

◆ mPerformancePointer

UINT8* mPerformancePointer = NULL

Definition at line 72 of file DxeCorePerformanceLib.c.

◆ mPerformanceProperty

PERFORMANCE_PROPERTY mPerformanceProperty

Definition at line 87 of file DxeCorePerformanceLib.c.

◆ mPlatformLanguage

CHAR8* mPlatformLanguage = NULL

Definition at line 71 of file DxeCorePerformanceLib.c.

◆ mSmmBootRecordOffset

UINTN mSmmBootRecordOffset = 0

Definition at line 76 of file DxeCorePerformanceLib.c.