perf: add an optional performance report #1851
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1851
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1851/head"
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?
@MrBigBritches on GitHub · 2026-10-22 23:45 UTC · original
MrBigBritches:perf-report→main· +841 −23 · 23 files · 6 commits · closed without mergingAdds an opt-in, plain-text performance report for investigating low frame rates. While a game runs, the emulator writes a summary every 5 seconds. It shows which code path made the CPU wait for the GPU or submit work, and which guest memory causes write-tracking faults. Those are frequently the questions behind many slowdowns, and a sampling profiler like Tracy answers them poorly.
Usage
--perf-report, and optionally--perf-report-file <path>._kyty_perf.txt. A relative path is relative to the working directory, as with the printf output file. The report doesn't depend on logging settings.What the report contains
Flush,FlushAndWait,Finish,WaitandSubmittake a defaultedstd::source_location, so callers are unchanged.docs/performance-report.mdexplains each line with a real example, and describes how to add a measurement. The README links to it.Cost
DebugCounters.Files
src/common/perfReport.h/.cpp,docs/performance-report.md.RenderContext::HandleFault), buffer cache, memory tracker, descriptors (GPU-written bindings), address-space protection, video-out flips.emulatorConfig,main.cpp, launcher configuration, dialog and.ui.Testing
shader_cfg_testsandmemory_tracker_testspass.@coderabbitai[bot] on GitHub · 2026-10-22 23:53 UTC · original · edited 2026-10-23 06:03 UTC
📝 Walkthrough
The change adds optional performance reporting with five-second intervals and a configurable output path. Launcher settings and command-line options control reporting. Instrumentation records GPU waits and submits, GPU activity, frame flips, buffer operations, memory-protection timing, and memory-tracking faults. Reports include call-site and memory-region details. The README and a new guide document how to enable and interpret reports.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Feature
Merge Risk: 🔵 Low · up to
5ebbdThe report can misidentify the GPU write responsible for an overlapping download fault. This is a bounded diagnostic error; the PR remains mergeable with follow-up.
Pre-merge checks:
4 ·
1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-10-22 23:53 UTC · original · edited 2026-10-23 00:31 UTC
On
docs/performance-report.mdline 65 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Use accurate proportions in the example.
The sample shows nearly every GPU wait from synchronous buffer downloads, but only about 85% of queue submits.
BufferFlushaccounts for 262.9 submits per second. Replace “nearly every GPU wait and queue submit” with “nearly every GPU wait and most queue submits.”Proposed wording
✅ Addressed in commit
f32e7a8@coderabbitai[bot] on GitHub · 2026-10-22 23:53 UTC · original · edited 2026-10-23 00:31 UTC
On
README.mdline 422 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Correct the attribution scope.
The report does not summarize memory-tracking faults by call site. It groups faults by 1 MiB region and shader write. Only GPU waits and queue submits have call-site lists.
Proposed wording
📝 Committable suggestion
✅ Addressed in commit
f32e7a8@ -0,0 +238,4 @@}std::fclose(s.file);s.file = nullptr;}@coderabbitai[bot] on GitHub · 2026-10-22 23:53 UTC · original · edited 2026-10-23 00:31 UTC
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 8627
Write the final partial interval when the report stops.
Normal exit does not write the final partial interval.
Execute()ends withstd::quick_exit(0), which skips theSubsystemsdestructor. Theat_quick_exithandler runs onlyCommon::Subsystems::EmergencyShutdownActive(), andConfig::Lifecycleregisters no emergency callback. ExplicitConfigure(false, ...)also closess.filewithout callingWriteInterval. A session shorter than 5 s writes only the header.Write any non-empty final interval in
Configure(false, ...). Register a report-only emergency callback inConfigso normal exit reaches it.Proposed change
📝 Committable suggestion
✅ Addressed in commit
f32e7a8@coderabbitai[bot] on GitHub · 2026-10-22 23:53 UTC · original · reviewed
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
7d60ebbe-5415-4c31-8741-dd37bbd62c82📥 Commits
Reviewing files that changed from the base of the PR and between
79837b423dandc23cc2b7df.📒 Files selected for processing: 23
README.mddocs/performance-report.mdsrc/common/emulatorConfig.cppsrc/common/emulatorConfig.hsrc/common/perfReport.cppsrc/common/perfReport.hsrc/graphics/guest_gpu/graphicsRun.cppsrc/graphics/host_gpu/memoryTracker.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/commandScheduler.cppsrc/graphics/host_gpu/renderer/commandScheduler.hsrc/graphics/host_gpu/renderer/masterSemaphore.cppsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/renderContext.cppsrc/graphics/presentation/videoOut.cppsrc/kernel/memory.cppsrc/kernel/memoryAddressSpace.incsrc/launcher/forms/configuration_edit_dialog.uisrc/launcher/include/configuration.hsrc/launcher/src/configuration.cppsrc/launcher/src/configurationEditDialog.cppsrc/launcher/src/mainDialog.cppsrc/main.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-23 00:40 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
9aab107a-4fd9-4ddc-b5d7-1d8e25f8d2a8📥 Commits
Reviewing files that changed from the base of the PR and between
c23cc2b7dfandf32e7a8488.📒 Files selected for processing: 6
README.mddocs/performance-report.mdsrc/common/emulatorConfig.cppsrc/common/emulatorConfig.hsrc/common/perfReport.cppsrc/common/perfReport.h🚧 Files skipped from review as they are similar to previous changes: 5
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-23 01:12 UTC · original · edited 2026-10-23 01:42 UTC
On
src/graphics/host_gpu/renderer/cache/bufferCache.cppline 316 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Count a download only when buffer data was copied.
If
DownloadBufferMemory<false>()finds no copies, it returnsfalse. This assignment still causesNoteDownload()to run after the callback.RenderContext::HandleFault()then reports a downloaded fault even though no buffer download occurred. Assign the return value ofDownloadBufferMemory<false>()todownloaded, and use that value for both the unmark operation andNoteDownload().✅ Addressed in commit
b57a503@coderabbitai[bot] on GitHub · 2026-10-23 01:12 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
6282cddf-dbd8-4c26-b8db-f0dad86e6af5📥 Commits
Reviewing files that changed from the base of the PR and between
f32e7a8488and284607f0f4.📒 Files selected for processing: 3
docs/performance-report.mdsrc/common/perfReport.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.cpp🚧 Files skipped from review as they are similar to previous changes: 1
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-23 01:47 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
fead853e-a40a-490f-892a-ab4b03586e5c📥 Commits
Reviewing files that changed from the base of the PR and between
284607f0f4andb57a503034.📒 Files selected for processing: 1
src/graphics/host_gpu/renderer/cache/bufferCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-23 02:19 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
8c5be271-c0fa-4743-a1c0-14fcbf237de5📥 Commits
Reviewing files that changed from the base of the PR and between
b57a503034and9b9afc9979.📒 Files selected for processing: 1
src/common/perfReport.hIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
@MrBigBritches on GitHub · 2026-10-23 05:59 UTC · original
@coderabbitai resume
@coderabbitai[bot] on GitHub · 2026-10-23 05:59 UTC · original · edited 2026-10-23 06:03 UTC
✅ Action performed
Reviews resumed and review finished.
@ -0,0 +387,4 @@auto& entry = s.gpu_writes[address];entry.size = std::max(entry.size, size);entry.shader_hash = shader_hash;entry.order = ++s.gpu_write_order;@coderabbitai[bot] on GitHub · 2026-10-23 06:03 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the binding order with its actual range.
If an address is rebound with a smaller size,
entry.sizekeeps the earlier, larger size, while this line gives the new shader the latest order. For example, after a large binding at0x1000, a binding at0x1800, and a small rebind at0x1000, a fault at0x1900can be attributed to the small rebind instead of the binding at0x1800. Store the range associated with each shader and order, or replace the retained size when recording the new binding.@coderabbitai[bot] on GitHub · 2026-10-23 06:03 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
69d0adae-cfb9-447a-8262-9b3e42d64b9c📥 Commits
Reviewing files that changed from the base of the PR and between
9b9afc9979and5ebbd5c56a.📒 Files selected for processing: 3
src/common/perfReport.cppsrc/graphics/guest_gpu/graphicsRun.cppsrc/launcher/src/configurationEditDialog.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Pull request closed