MCPcopy Create free account
hub / github.com/FastLED/FastLED / _format_timing_summary

Function _format_timing_summary

ci/util/test_runner.py:997–1113  ·  view source on GitHub ↗

Format a summary of process execution times with optional phase breakdown. Always returns a table format for consistent display.

(process_timings: list[ProcessTiming])

Source from the content-addressed store, hash-verified

995
996
997def _format_timing_summary(process_timings: list[ProcessTiming]) -> str:
998 """Format a summary of process execution times with optional phase breakdown.
999
1000 Always returns a table format for consistent display.
1001 """
1002 if not process_timings:
1003 return ""
1004
1005 # Sort by skipped status first (non-skipped first), then by duration (longest first)
1006 sorted_timings = sorted(process_timings, key=lambda x: (x.skipped, -x.duration))
1007
1008 # Check if any timing has phase data (for Meson tests)
1009 has_phases = any(
1010 t.meson_setup_time and t.meson_setup_time > 0 for t in sorted_timings
1011 )
1012
1013 # Build timing rows (main tests + phases if available)
1014 timing_rows: list[tuple[str, str]] = []
1015
1016 # First pass: add all main test entries
1017 for timing in sorted_timings:
1018 if timing.skipped:
1019 duration_str = "skipped"
1020 else:
1021 duration_str = f"{timing.duration:.2f}s"
1022 timing_rows.append((timing.name, duration_str))
1023
1024 # Second pass: add phase breakdown if available
1025 if has_phases and not timing.skipped:
1026 phases = []
1027 if timing.meson_setup_time and timing.meson_setup_time > 0:
1028 phases.append((" ├─ Meson Setup", f"{timing.meson_setup_time:.2f}s"))
1029 if timing.compile_time and timing.compile_time > 0:
1030 # Check if we have compile sub-phases
1031 has_sub_phases = any(
1032 [
1033 timing.compile_core_time and timing.compile_core_time > 0,
1034 timing.compile_objects_time and timing.compile_objects_time > 0,
1035 timing.compile_example_link_time
1036 and timing.compile_example_link_time > 0,
1037 timing.compile_test_link_time
1038 and timing.compile_test_link_time > 0,
1039 ]
1040 )
1041 phases.append((" ├─ Compilation", f"{timing.compile_time:.2f}s"))
1042 if has_sub_phases:
1043 sub = []
1044 if timing.compile_core_time and timing.compile_core_time > 0:
1045 sub.append(
1046 (" │ ├─ Core + PCH", f"{timing.compile_core_time:.2f}s")
1047 )
1048 if timing.compile_objects_time and timing.compile_objects_time > 0:
1049 sub.append(
1050 (
1051 " │ ├─ Object files",
1052 f"{timing.compile_objects_time:.2f}s",
1053 )
1054 )

Callers 1

runnerFunction · 0.85

Calls 3

anyFunction · 0.85
maxFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected