Calculate compile sub-phase durations from timestamps and set on result.
(
result: MesonTestResult, sub_phases: dict[str, float]
)
| 38 | |
| 39 | |
| 40 | def _apply_compile_sub_phases( |
| 41 | result: MesonTestResult, sub_phases: dict[str, float] |
| 42 | ) -> None: |
| 43 | """Calculate compile sub-phase durations from timestamps and set on result.""" |
| 44 | if not sub_phases: |
| 45 | return |
| 46 | |
| 47 | compile_start = sub_phases.get("compile_start") |
| 48 | core_done = sub_phases.get("core_done") |
| 49 | example_link_start = sub_phases.get("example_link_start") |
| 50 | test_link_start = sub_phases.get("test_link_start") |
| 51 | compile_done = sub_phases.get("compile_done") |
| 52 | |
| 53 | if compile_start and core_done: |
| 54 | result.compile_core_time = core_done - compile_start |
| 55 | if core_done and compile_done: |
| 56 | link_start = None |
| 57 | if example_link_start and test_link_start: |
| 58 | link_start = min(example_link_start, test_link_start) |
| 59 | elif example_link_start: |
| 60 | link_start = example_link_start |
| 61 | elif test_link_start: |
| 62 | link_start = test_link_start |
| 63 | |
| 64 | if link_start: |
| 65 | result.compile_objects_time = link_start - core_done |
| 66 | else: |
| 67 | result.compile_objects_time = compile_done - core_done |
| 68 | |
| 69 | if example_link_start and compile_done: |
| 70 | end = test_link_start if test_link_start else compile_done |
| 71 | result.compile_example_link_time = end - example_link_start |
| 72 | if test_link_start and compile_done: |
| 73 | result.compile_test_link_time = compile_done - test_link_start |
| 74 | |
| 75 | |
| 76 | def _recover_stale_build( |
no test coverage detected