diff options
| author | nova-aryan <81568644+nova-aryan@users.noreply.github.com> | 2026-11-24 02:56:30 +0530 |
|---|---|---|
| committer | nova-aryan <81568644+nova-aryan@users.noreply.github.com> | 2026-11-24 02:56:33 +0530 |
| commit | 8f412a3f2f13528bcdcaa2eef50781d163a32beb (patch) | |
| tree | be88341168d538c37140d30d2163e282b48b22f4 /tools/boot_trace.py | |
| parent | 5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff) | |
Count D3D12 outcomes per method in boot traces
Diffstat (limited to 'tools/boot_trace.py')
| -rw-r--r-- | tools/boot_trace.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/boot_trace.py b/tools/boot_trace.py index 24bafbe47..a5010d178 100644 --- a/tools/boot_trace.py +++ b/tools/boot_trace.py | |||
| @@ -31,6 +31,7 @@ import re | |||
| 31 | import sys | 31 | import sys |
| 32 | 32 | ||
| 33 | D3D12_LINE = re.compile(r"^(?:.+ : )?\[d3d12-trace\] #(\d+) (.+) (\S+)\s*$") | 33 | D3D12_LINE = re.compile(r"^(?:.+ : )?\[d3d12-trace\] #(\d+) (.+) (\S+)\s*$") |
| 34 | D3D12_PROBLEMS = ("failed", "unsupported", "refused", "partial") | ||
| 34 | 35 | ||
| 35 | 36 | ||
| 36 | class TraceError(ValueError): | 37 | class TraceError(ValueError): |
| @@ -179,6 +180,7 @@ def parse_d3d12(path: str, limit: int = 10) -> dict: | |||
| 179 | "outcomes": {}, | 180 | "outcomes": {}, |
| 180 | "methods": [], | 181 | "methods": [], |
| 181 | "first": {}, | 182 | "first": {}, |
| 183 | "method_outcomes": {}, | ||
| 182 | "failed": [], | 184 | "failed": [], |
| 183 | "unsupported": [], | 185 | "unsupported": [], |
| 184 | "refused": [], | 186 | "refused": [], |
| @@ -203,10 +205,12 @@ def parse_d3d12(path: str, limit: int = 10) -> dict: | |||
| 203 | trace["sequence_breaks"].append({"expected": expected, "observed": seq}) | 205 | trace["sequence_breaks"].append({"expected": expected, "observed": seq}) |
| 204 | trace["last_seq"] = seq | 206 | trace["last_seq"] = seq |
| 205 | trace["outcomes"][outcome] = trace["outcomes"].get(outcome, 0) + 1 | 207 | trace["outcomes"][outcome] = trace["outcomes"].get(outcome, 0) + 1 |
| 208 | counts = trace["method_outcomes"].setdefault(method, {}) | ||
| 209 | counts[outcome] = counts.get(outcome, 0) + 1 | ||
| 206 | if method not in trace["first"]: | 210 | if method not in trace["first"]: |
| 207 | trace["methods"].append(method) | 211 | trace["methods"].append(method) |
| 208 | trace["first"][method] = {"seq": seq, "outcome": outcome} | 212 | trace["first"][method] = {"seq": seq, "outcome": outcome} |
| 209 | if outcome in ("failed", "unsupported", "refused", "partial"): | 213 | if outcome in D3D12_PROBLEMS: |
| 210 | bucket = trace[outcome] | 214 | bucket = trace[outcome] |
| 211 | if len(bucket) < limit: | 215 | if len(bucket) < limit: |
| 212 | bucket.append({"seq": seq, "method": method}) | 216 | bucket.append({"seq": seq, "method": method}) |
| @@ -309,6 +313,15 @@ def format_text(summary: dict, limit: int) -> str: | |||
| 309 | out.append(f" expected #{item['expected']}, observed #{item['observed']}") | 313 | out.append(f" expected #{item['expected']}, observed #{item['observed']}") |
| 310 | if d3d12["methods"]: | 314 | if d3d12["methods"]: |
| 311 | out.append(f" first per method: {_tail(d3d12['methods'], limit)}") | 315 | out.append(f" first per method: {_tail(d3d12['methods'], limit)}") |
| 316 | problems = [] | ||
| 317 | for method, counts in d3d12["method_outcomes"].items(): | ||
| 318 | failures = {outcome: counts[outcome] for outcome in D3D12_PROBLEMS if outcome in counts} | ||
| 319 | if failures: | ||
| 320 | problems.append((sum(failures.values()), method, failures)) | ||
| 321 | if problems: | ||
| 322 | out.append(" methods by problem count:") | ||
| 323 | for _, method, counts in sorted(problems, key=lambda row: (-row[0], row[1]))[:limit]: | ||
| 324 | out.append(f" {method}: " + ", ".join(f"{outcome} {n}" for outcome, n in counts.items())) | ||
| 312 | if d3d12["unsupported"]: | 325 | if d3d12["unsupported"]: |
| 313 | unsupported = [f"#{c['seq']} {c['method']}" for c in d3d12["unsupported"]] | 326 | unsupported = [f"#{c['seq']} {c['method']}" for c in d3d12["unsupported"]] |
| 314 | out.append(f" unsupported: {_tail(unsupported, limit)}") | 327 | out.append(f" unsupported: {_tail(unsupported, limit)}") |