Patina Performance Component
The Patina performance component acts as the translation layer between the core's performance implementation, and the UEFI and ACPI implementations.
Responsibilities
- Publish the FBPT at End of DXE so the operating system can consume it later.
- Expose the EDK II measurement protocol (
EdkiiPerformanceMeasurement) for C drivers that need to log performance data. - Publish performance properties through a configuration table.
- Optionally merge Management Mode (MM) performance records when an MM communication region is available.
Configuration
Whether performance measurement is enabled is decided by the DXE Core, not by this component. The core resolves the
performance configuration from a PerformanceConfigHob, falling back to the platform-provided
PlatformInfo::DEFAULT_PERFORMANCE_CONFIG when no such HOB is present. When performance is enabled the core
publishes the PerformanceManager service; when it is disabled that service is absent, so this component's
service dependency is unsatisfied and it does not dispatch.
A platform therefore enables performance in one of two ways:
- Production of the
PerformanceConfigHobprior to Patina DXE Core execution (this takes priority), or - Setting
PlatformInfo::DEFAULT_PERFORMANCE_CONFIGto an enabled configuration with the desiredMeasurementvalues.
use PerformanceConfig;
use *;
;
API
The functions below are provided by the PerformanceManager service (produced by the DXE Core) and the core
internals; this component makes them reachable from external C modules through the EdkiiPerformanceMeasurement
protocol.
| Macro name in EDK II | Function name in Patina | Description |
|---|---|---|
PERF_START_IMAGE_BEGIN PERF_START_IMAGE_END |
perf_image_start_beginperf_image_start_end |
Measure the performance of start image in core. |
PERF_LOAD_IMAGE_BEGINPERF_LOAD_IMAGE_END |
perf_load_image_beginperf_load_image_end |
Measure the performance of load image in core. |
PERF_DRIVER_BINDING_SUPPORT_BEGIN PERF_DRIVER_BINDING_SUPPORT_END |
perf_driver_binding_support_beginperf_driver_binding_support_end |
Measure the performance of driver binding support in core. |
PERF_DRIVER_BINDING_START_BEGINPERF_DRIVER_BINDING_START_END |
perf_driver_binding_start_beginperf_driver_binding_start_end |
Measure the performance of driver binding start in core. |
PERF_DRIVER_BINDING_STOP_BEGINPERF_DRIVER_BINDING_STOP_END |
perf_driver_binding_stop_beginperf_driver_binding_stop_end |
Measure the performance of driver binding stop in core. |
PERF_EVENT |
perf_event |
Measure the time from power-on to this function execution. |
PERF_EVENT_SIGNAL_BEGINPERF_EVENT_SIGNAL_END |
perf_event_signal_beginperf_event_signal_end |
Measure the performance of event signal behavior in any module. |
PERF_CALLBACK_BEGINPERF_CALLBACK_END |
perf_callback_beginperf_callback_end |
Measure the performance of a callback function in any module. |
PERF_FUNCTION_BEGINPERF_FUNCTION_END |
perf_function_beginperf_function_end |
Measure the performance of a general function in any module. |
PERF_INMODULE_BEGINPERF_INMODULE_END |
perf_in_module_beginperf_in_module_end |
Measure the performance of a behavior within one module. |
PERF_CROSSMODULE_BEGINPERF_CROSSMODULE_END |
perf_cross_module_beginperf_cross_module_end |
Measure the performance of a behavior in different modules. |
PERF_STARTPERF_START_EXPERF_ENDPERF_END_EX |
perf_startperf_start_experf_endperf_end_ex |
Make a performance measurement. |
Logging Performance Measurements
Performance measurements are recorded through the PerformanceManager service, which is produced by the DXE
Core and consumed both internally by the core and by components via dependency injection.
Example of recording a measurement through the service:
# extern crate patina;
use ;
use CALLER_ID;
Performance Component Overview
The performance measurement API is provided by the PerformanceManager service, which is produced by the DXE
Core. This component contributes the UEFI-facing pieces on top of it:
- The EDK II Performance Measurement protocol, produced by this component, for use by external (C) modules.
- Publishing of the FBPT and performance properties.
Patina code (core or components) records measurements through the PerformanceManager service. External modules
use the function returned by the EdkiiPerformanceMeasurement protocol, which routes back into the same service.
Initialization and Setup
The DXE Core initializes the FBPT, seeds it with any pre-DXE performance HOB data, and applies the measurement mask before this component runs. Upon initialization, the component performs the following steps:
-
Install the
EdkiiPerformanceMeasurementProtocol- Enables external modules to log performance data through the measurement service.
-
Register Events
- One event collects performance records logged in Management Mode (MM).
- Another event publishes the FBPT to allocate the table in reserved memory at the end of the DXE phase.
-
Install Performance Properties
- Exposes performance-related properties through a configuration table for use by other components.
Scope and Limitations
This component only publishes the FBPT, as it specifically manages the additional record fields within it. Other tables, such as the Firmware Performance Data Table (FPDT), are published by separate components.