feat(tools): digest a performance trace for an issue or a pull request #4581
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4581"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-12T16:09:35Z.
Step 2b of #4477.
tools/trace_digest.pyturns a trace from #4526 (and optionally a collapsed-stack file from #4570) into a markdown report of a few KB to paste into an issue, a pull request or a chat with an AI.--jsonprints the same data as JSON.What
python3 tools/trace_digest.py aps5-trace-<commit>-<pid>.json.gz [--stacks worker.collapsed.txt] [--frames 5] [--top 10] [--json]aps5-summary.jsonlnext to the trace whosetracefield names this file (--summarytakes another file), as a short header and as the raw JSON line.--frameslongest intervals between presents. For each: the present, its length, when it started, and the four largest slices inside it (inclusive time clipped to the frame, with their thread).wait:Driver.WorkerWait,Driver.Packet.memory_wait,Driver.Present.inflight_wait, ...), untraced (no top-level slice, which includes the time in slices under 20 us), the thread'sfoldedcounter, and its two largest top-level slices.--stacks): sample count, share of truncated walks, and the topself(leaf) andtotalframes. The frames that every complete stack shares (the thread's entry path) are left out oftotal.Python standard library only, like the other tools. The trace and the summary are read as #4526 writes them, but the tool does not depend on that pull request to build or test.
Tested
trace_digest(new,tools/tests/test_trace_digest.py, registered with the other tool tests): a synthetic trace of two threads and three presents, a summary file with two lines, and a collapsed file. It checks that the right summary line is picked, that the frames end at the window, the slowest frame and its clipped slices, the busy, wait, untraced and folded split of both threads, the largest slices, the longest waits with their present, self and total stacks without the shared frames, and the command line (markdown under 5 KB with every section, and--json). It passes with Python 3.14 on Windows 11 and Python 3.12 on Ubuntu 24.04 (WSL).The capture of #4526 (Sword of the Sea menu, 120 presents, 284,124 events) with the stacks of #4570: 2.1 s and 4.6 KB of markdown. For example, the thread table:
The ten longest waits are all
Driver.Packet.memory_waiton queue worker 0x20, 43 to 48 ms each.Conventions:
tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T19:33:40Z.
Rebased on main: the only conflict was the root
CMakeLists.txt, wherepad_inputlanded next totrace_digest; both registrations are kept.test_trace_digest.pypasses (8/8).End to end check: I wrote a 6-present window with #4526's
TraceFormat::Events/SummaryandTraceFile::WriteGzip(compiled against the bundled zlib) and fed it to the script. Its summary line matches the C++ one field for field (frame p50/p90/p99, GPU busy per present, worker busy, top phases), and the slow frame and the waits land on the right presents.I'll merge this right after #4526, following the order in #4477.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T20:09:34Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)CMakeLists.txtL101