trace: the queue-0 worker fills its 262,144-event buffer in about 3 s, so a 30 s window keeps only its first tenth, and trace_dropped doesn't say which thread or when #5786
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 eliyarson on 2026-10-14T10:47:39Z.
What happens. In a busy scene the queue-0 worker's trace buffer fills about 3.3 s into an
APS5_TRACE_SECONDS=150:30window. After that the trace has no slices for that thread, while the presenter andgputracks run to the end of the window. That worker is the thread most performance reports are about. The summary line stays correct, because thread totals keep accumulating after the buffer is full. The only sign is"trace_dropped":true, which doesn't say which thread stopped, when, or how much was lost.Measured. Hades II, hub after the intro (the #5485 scene), Linux, RTX 3080 Ti,
maina0f5916a2and665ad7da7,APS5_TRACE_SECONDS=150:30. These are six traces read back from the.json.gzfiles:queue worker 0x0slicesa0f5916a2665ad7da7#1665ad7da7#2665ad7da7#3665ad7da7#4665ad7da7#5Frame p50 in these runs is 31–35 ms, so the worker writes about 80,000 slices of 20 µs or longer per second, roughly 2,600 per frame. All 33 traces we have recorded of this scene (11 on
maincommits, 22 on a local branch) reporttrace_dropped=true. (@MarcZX100 asked about this on #5485.)Why (
main3e577edac):TraceThread::DefaultCapacity = 262144(Execution/include/PerformanceTrace.hpp:128). Every thread gets the same size throughBindThread(src/PerformanceTrace.cpp:138-141; queue workers bind at Driver/Queues/QueueWorker.cpp:87).appendsetsdroppedand returns once the buffer is full (PerformanceTrace.hpp:195-203). Nothing marks where the thread's slices stop.trace_droppedis one flag OR-ed over all threads (:408-410, :431). The same flag is also set when the 512-entry totals table is full (account, :205-222). That second case is different: there the summary totals themselves are incomplete. The summary can't tell the two apart.A slice is 32 bytes, so the default buffer is 8 MiB per thread. Covering this 30 s window on queue 0 would take about 2.5 M slices, around 80 MiB.
Proposal (opt-in; defaults unchanged):
"trace_dropped":{"queue worker 0x0":{"events_after_s":3.32,"lost":2240000}}for a full event buffer and a separate"totals_full"entry when the totals table overflows, so a reader knows whether the summary numbers are still complete. Also keep a plain boolean for existing readers (for exampletrace_dropped_any), or keep the boolean under its current name and add the detail astrace_dropped_threads.trace buffer fullon the thread at the time of its first lost slice, so Perfetto shows where the track ends.APS5_TRACE_EVENTS=<n>to size the per-thread buffer (whole number, bounded, malformed value fails the first present, like the other trace switches), and document the memory cost in BUILD.md.tools/trace_digest.pyprint the per-thread cut-off.I can send a PR for this, starting with 1 and 2, unless someone already has it in progress or the trace owners prefer a different shape (for example a ring that keeps the last N events instead of the first N).
Imported from boykopovar/AnyPS5. Originally posted by eliyarson on 2026-10-14T17:20:35Z.
Fixed by #5808 (
APS5_TRACE_EVENTS) and #5813 (per-threadtrace_dropped_threadsand thetrace buffer fullevent). The optionaltrace_digest.pycut-off (item 4) isn't done; I'm leaving that for whoever needs it.