bundle.perf_report.report.base ============================== .. py:module:: bundle.perf_report.report.base .. autoapi-nested-parse:: Shared utilities for performance report generation (cProfile and Tracy). Attributes ---------- .. autoapisummary:: bundle.perf_report.report.base.LOGGER bundle.perf_report.report.base.MAX_PARALLEL_ASYNC bundle.perf_report.report.base.TOP_N_PLOT bundle.perf_report.report.base.TOP_N_TABLE bundle.perf_report.report.base.TIME_THRESHOLDS bundle.perf_report.report.base.CLR_CURRENT bundle.perf_report.report.base.CLR_BASELINE Functions --------- .. autoapisummary:: bundle.perf_report.report.base.format_time_seconds bundle.perf_report.report.base.format_time_ns bundle.perf_report.report.base.format_delta bundle.perf_report.report.base.delta_color bundle.perf_report.report.base.best_unit_for_values_seconds bundle.perf_report.report.base.best_unit_for_values_ns bundle.perf_report.report.base.shorten_path bundle.perf_report.report.base.normalize_src_path bundle.perf_report.report.base.safe_key bundle.perf_report.report.base.get_platform_id bundle.perf_report.report.base.get_platform_meta bundle.perf_report.report.base.truncate_labels bundle.perf_report.report.base.setup_plot bundle.perf_report.report.base.draw_baseline_bars bundle.perf_report.report.base.finalize_plot bundle.perf_report.report.base.build_platform_section bundle.perf_report.report.base.find_baseline_version bundle.perf_report.report.base.generate_report Module Contents --------------- .. py:data:: LOGGER .. py:data:: MAX_PARALLEL_ASYNC :value: 20 .. py:data:: TOP_N_PLOT :value: 10 .. py:data:: TOP_N_TABLE :value: 30 .. py:data:: TIME_THRESHOLDS :value: [(1.0, 's', 1.0), (0.001, 'ms', 1000.0), (1e-06, 'μs', 1000000.0), (0.0, 'ns', 1000000000.0)] .. py:data:: CLR_CURRENT :value: '#87CEEB' .. py:data:: CLR_BASELINE :value: '#FF8C66' .. py:function:: format_time_seconds(seconds: float) -> tuple[str, str] Format a seconds value into a human-readable (value, unit) pair. .. py:function:: format_time_ns(nanoseconds: int | float) -> tuple[str, str] Format a nanosecond value into a human-readable (value, unit) pair. .. py:function:: format_delta(current: int | float, baseline: int | float) -> str .. py:function:: delta_color(current: int | float, baseline: int | float) -> str .. py:function:: best_unit_for_values_seconds(times_seconds: list[float]) -> tuple[str, float] Return the best (unit, multiplier_from_seconds) for a list of second values. .. py:function:: best_unit_for_values_ns(times_ns: list[int | float]) -> tuple[str, float] Return the best (unit, multiplier_from_ns) for a list of nanosecond values. .. py:function:: shorten_path(file_path: str, max_parts: int = 2) -> str Truncate a file path to its last ``max_parts`` segments. .. py:function:: normalize_src_path(src_file: str) -> str Extract bundle-relative path: .../bundle/core/tracer.py -> core/tracer.py .. py:function:: safe_key(v: str) -> str .. py:function:: get_platform_id() -> str .. py:function:: get_platform_meta() -> dict .. py:function:: truncate_labels(labels: list[str], max_len: int = 50) -> list[str] .. py:function:: setup_plot(n_bars: int, has_baseline: bool) -> tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes, numpy.ndarray] Create a dark-themed horizontal bar chart canvas. .. py:function:: draw_baseline_bars(ax: matplotlib.pyplot.Axes, y_pos: numpy.ndarray, baseline_times: list[float], bar_height: float) Draw baseline comparison bars and add the legend. .. py:function:: finalize_plot(fig: matplotlib.pyplot.Figure, ax: matplotlib.pyplot.Axes, bars: Any, max_val: float, xlabel: str, plot_path: pathlib.Path) -> pathlib.Path Apply bar-value labels, axis formatting, and save the plot. .. py:function:: build_platform_section(meta: dict) -> bundle.latex.Section Build a platform info summary table from HDF5 metadata. .. py:function:: find_baseline_version(storage: Any, current_version: str, platform_id: str) -> str | None Find the most recent version in HDF5 that isn't the current one and has this platform. .. py:function:: generate_report(input_path: pathlib.Path, output_path: pathlib.Path, h5_path: pathlib.Path | None, *, extractor_cls: Any, storage_cls: Any, generate_plot_fn: Callable, build_section_fn: Callable, build_func_map_fn: Callable, file_type_label: str) :async: Generic report generation pipeline shared by cProfile and Tracy backends.