Perf report generator
perf_report_generator ¶
perf_report_generator.py.
Copyright © Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent
This module provides tools for parsing Firmware Performance Data Table (FPDT) XML data and generating performance reports in text and HTML formats. It includes functionality to extract GUIDs from UEFI source files, process FPDT records, and produce detailed timing information for firmware boot processes.
Functions:
Name | Description |
---|---|
add_guid |
str, name: str, guid_dict: dict) -> None: Add a GUID and its associated name to the GUID dictionary. |
parse_guids_in_directory |
str, guid_dict: dict) -> None: Parse GUIDs within the specified directory and add them to the GUID dictionary. |
main |
Main function to parse command-line arguments and generate performance reports. |
Constants
add_guid ¶
add_guid(guid: str, name: str, guid_dict: dict) -> None
Add a GUID and its associated name to the guid_dict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guid |
str
|
The GUID to add. |
required |
name |
str
|
The name associated with the GUID. |
required |
guid_dict |
dict
|
The dictionary to store the GUID and name. |
required |
parse_guids_in_directory ¶
parse_guids_in_directory(
input_path: str, guid_dict: dict
) -> None
Parse GUIDs within the specified directory and add them to the GUID dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_path |
str
|
The path to the directory to parse. |
required |
guid_dict |
dict
|
The dictionary to store parsed GUIDs. |
required |
main ¶
main() -> int
Main function to parse command-line arguments and generate performance reports.
parse_arguments ¶
parse_arguments() -> argparse.Namespace
Parse command-line arguments.
Returns:
Type | Description |
---|---|
Namespace
|
argparse.Namespace: Parsed command-line arguments. |
Command-line arguments
-t, --output_text: Name of the output text file (default: None). -r, --output_html: Name of the output HTML file (default: None). -i, --input_xml_file: Path to the input XML file with raw FPDT data (default: None). -s, --src_tree_root: Root of UEFI Code tree to parse for GUIDs (default: None, accepts multiple values). -d, --debug: Enable debug output (default: False). -l, --output_debug_log: Log all debug and error output to a file (default: None).
parse_source_tree ¶
parse_source_tree(
src_tree_root: list[str], guids: dict[str, str]
) -> None
Parse the source tree for GUIDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src_tree_root |
list[str]
|
List of source tree root paths to parse. |
required |
guids |
dict[str, str]
|
Dictionary to store parsed GUIDs. |
required |
parse_fpdt_records ¶
parse_fpdt_records(
input_xml_file: str, text_log: str, guids: dict
) -> tuple
Parses Firmware Performance Data Table (FPDT) records from an input XML file and generates a timing list.
This function processes various types of performance records, including basic boot events, dynamic string events, GUID-based events, and others. It extracts relevant timing information, organizes it into a list of tuples, and optionally writes the output to a text log file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_xml_file |
str
|
Path to the input XML file containing performance records. |
required |
text_log |
str
|
Path to the output text log file. If None, no text log is generated. |
required |
guids |
dict
|
A dictionary mapping GUIDs to their corresponding string representations. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
A tuple containing:
- timing_list (list): A sorted list of tuples, where each tuple contains:
( |
Notes
- The function logs critical errors if no FBPT records are found or if unrecognized record types are encountered.
- The timing list is sorted by start times before being returned.
- Unmatched start records are checked and logged as warnings.
write_html_report ¶
write_html_report(
input_xml_file: str,
timing_list: list[
tuple[str, str, str, str, str, float, float]
],
messages: list[tuple[str, str]],
html_report: TextIO,
) -> None
Write the timing list and messages to an HTML report.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_xml_file |
str
|
Path to the input XML file with raw FPDT data. |
required |
timing_list |
list[tuple[str, str, str, str, str, float, float]]
|
List of timing data tuples. |
required |
messages |
list[tuple[str, str]]
|
List of message tuples. |
required |
html_report |
TextIO
|
File object for the HTML report. |
required |