Proposal: one shared performance trace format (Chrome trace-event JSON) and a summary line, so perf numbers can be compared #4477
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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-12T13:01:40Z.
Perf reports and PRs use different profilers, so the numbers are hard to compare (raised in the dev chat). I'd like one capture that everyone runs the same way, and a template that asks for its output.
What exists today
APS5_PROFILE_DRAW=1prints about 40[tag]lines ([present],[draw],[lock],[guestmem],[groupcap], ...) throughProfileOutputto stderr, one report per 10 s window.[present]has the presents, p50/p90/max wait, GPU busy and idle gaps per present.[draw]has driver phases in us per packet.[lock]is per queue worker.APS5_PROFILE_GPU=1adds timestamp queries per recorded range, reported on[gputime]every 10 s by program address and by command class (Recorder::CommandClass).APS5_NO_LOCK_PROFILE,APS5_NO_HOLD_PROFILEandAPS5_NO_HOOKSYNC_PROFILEturn parts of this off.-DAPS5_ENABLE_TIMING_LOG=ONwrites a per-flip[FrameTiming]line toframe-timing.log(FrameTiminginPerformanceTimer.hpp).These are 10 s aggregates, so a stall or a single slow frame is not visible, and the text formats differ per line. #3815 (
APS5_TRACE_CALLS) traces library calls, not time; it does not overlap, but it could write into the same file later.Proposal
APS5_TRACE_FRAMES=<start>:<count>(presents, e.g.600:300) orAPS5_TRACE_SECONDS=<start>:<length>. Nothing is recorded outside the window. It writesaps5-trace-<commit>-<pid>.json.gzto the working directory (APS5_TRACE_DIRoverrides). Format: Chrome trace-event JSON, which opens in ui.perfetto.dev (local, no upload), chrome://tracing, and can be imported into Tracy.queue 0x..), the front end (packet decode,Graphics::Draw), the presenter, and the shader/pipeline compile threads. A GPU track is built from the existing timestamp queries (BeginGpuTiming/EndGpuTiming), with the same classes as[gputime](Draw, Copy, Fill, PresentBlit, ...) plus one slice per batch.ph:X) named after the current metric keys (Driver.Packet,Driver.WorkerWait,Submission.queue, lock waits by site), onepresentinstant per flip, counters (ph:C) for batches in flight. Args carry only counts, bytes, hashes and guest program addresses.aps5-summary.jsonlnext to the trace:commit,dirty,env(allAPS5_*set),gpu,driver,os,resolution,window,presents,frame_ms{p50,p90,p99,max},gpu_busy_ms_per_present,worker_busy_pctper queue,top_phases_ms_per_frame(top 8),trace_dropped.ProfileOutputwriter thread, so no I/O on a worker. At the cap (default 20 MB gzipped, under GitHub's 25 MB attachment limit) it stops and setstrace_dropped, rather than slowing the title down. Slices under 20 us are folded into counters.FrameTiming,ProfileOutput(bounded queue, drop count) andShaderDeviceProfile(device and limits for the GPU/driver fields). The[...]lines stay as they are.-DAPS5_ENABLE_TRACY=ON, built from a submodule as the PR checklist asks). The same zones would feed both outputs.Privacy
A trace contains timings, event names, counts, byte sizes, thread names, and guest addresses or hashes of programs. It contains no game memory, no file names or paths of the title, no strings from the title and no user name. The summary has the machine's GPU, driver and OS version.
Measurement protocol (for the template)
APS5_TRACE_*orAPS5_PROFILE_*switch and no log redirect, since they cost time. OnlyAPS5_TRACE_FRAMES..json.gzand paste the summary line.A perf issue and PR template would ask for: summary line, trace file, commit, env switches, GPU, driver, OS, which scene.
Questions: is a present-count window the right default? Is
.jsonlnext to the trace acceptable, or should the summary go into the trace metadata only? I can write the first PR (capture and summary for the queue workers and presenter), and leave GPU track and templates for follow-ups.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-12T13:07:36Z.
LGTM +1
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-12T13:19:10Z.
+1
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-12T14:32:43Z.
@adriadam10 draft for step 1 (#4526) of #4477 is up, as asked. Step 2 (folded stacks from the existing worker sampler, for speedscope/flamegraphs) follows as a separate small PR.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-12T18:26:31Z.
Item 7 is up as #4607.
-DAPS5_ENABLE_TRACY=ON(defaultOFF) builds the Tracy 0.14.1 client from a new3rdparty/tracysubmodule (3-clause BSD) and reports everyPerformanceTimerscope as a Tracy zone, one frame per presented flip, with the queue workers and the presenter named.What it brings in, for the decision here:
main;__cxa_thread_atexitlinked into the Tracy client, because emulated TLS freesthread_localobjects before their destructors run (the problem fixed in #4029).It doesn't need the trace format of #4526: both hook
PerformanceTimerand conflict in two lines ofPerformanceTimer.hpp, so whichever lands first, the other rebases. Tested on Windows with a capture of Unpacking (PPSA07117); not built on Linux.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T18:38:41Z.
In favour, and I'm taking it in steps. A fixed capture window with a summary line that records the commit, the GPU and driver and the switches of the run is what the performance reports here have been missing: most of this week's numbers came from different profilers on patched trees and could not be compared.
Order: #4570 (collapsed stacks) first, since it adds no variable and no dependency, then #4526 once its Linux build is green and it is rebased over #4570. #4570 conflicts with
mainsince #4511 went in (Unwind.cpp, the block it moves into the header); please rebase it. #4632 and #4581 are reviewed after that as usual. #4607 (Tracy) fits as the optional step 7 on the same timers; it will need a rebase over #4526.#4590 changes the issue forms under
.github/, so that one waits for the owner.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T19:19:20Z.
On the two questions:
APS5_TRACE_SECONDSstays useful for titles that stall before presenting.aps5-summary.jsonlnext to the trace is fine. The line is what gets pasted into an issue or a PR, and keeping it out of the trace leaves the trace a plain Chrome trace that every viewer opens.Reviewed #4526 (Linux build, tests, and the gzip output checked with independent readers); comment there. We'll report the shader-object measurements of #2242 with this summary line once it is on
main.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:09:34Z.
Status of the plan:
APS5_TRACE_FRAMES/APS5_TRACE_SECONDS, trace +aps5-summary.jsonl): #4526, merged.tools/trace_digest.py: #4581, merged.-DAPS5_ENABLE_TRACY=ON): #4607, merged.Next: a section in the progress comment of each PR, showing the delta between the summary lines of main and of the PR when someone pastes both (same GPU, driver, resolution, window and switches; otherwise it says why it can't compare). That will be a separate PR.