Repository navigation
Record frame times from a game's launch options, and chart them - #112
Conversation
|
Thanks, the summary matching |
|
Rebased onto main. The new strings have their Swedish entries, and the recording is added on top of |
The host already writes a timing row per frame when DM_NVN_TSV names a file (the rows scripts/bench.py reads), but only from the command line. A game's launch options now have a Frame times section: a switch makes Play pass DM_NVN_TSV (timing rows only, DM_NVN_TSV_CALLS=0) to a new file in <library>/frame-times/<title ID>/, and the last three recordings are summed up as bench.py counts them (nearest-rank percentiles: median, 99 %, slowest, frames over 50 ms, dropped frames) and charted, the hitches marked. Off by default. Rebased onto main: the desktop Play now builds its environment with GameStart.environment, and the recording is added on top of it by one helper (FrameTimes.recordingEnvironment) that console mode's Play calls too, so a game whose recording is on is recorded however it is started. The strings have their Swedish entries (LNPANDY#168). Checked after the rebase: swift build; swift test, 368 tests, 0 failures (FrameTimesTests gains testBothWaysOfStartingAGameRecordTheSame and checks the Swedish entries; ConsoleLiveTests unchanged).
The release build on the CI runner stopped at ConsoleControllersView.swift:133 ("the compiler is unable to type-check this expression in reasonable time"): the chip's spoken label was one + chain of optionals, String(format:) calls and ?? defaults. It is now chipLabel(_:), the same parts (name, kind, player, battery) joined by ", " with explicit types, so the text is unchanged.
Checked: swift build -c release; swift test, 436 tests, 0 failures.
|
The native macOS build failed at |
|
Thanks, @subyoung. The split chip label reads the same and is easier on the type checker, so it is fine to carry it here. I approved the new runs. The merge plan for tomorrow stands once they are green. |
|
Thanks @subyoung. I merged main into the branch once more, with your commits unchanged (a merge commit, no rebase). The conflicts were in the Play paths and the Swedish strings. The |
What and why
The host already writes a timing row per frame when
DM_NVN_TSVnames a file (dm/gfx/nvn/hle_nvn.c, the rowsscripts/bench.pyreads), but only from the command line. A player who sees a stutter or a slow place has no way to record it from the launcher, or to show numbers in an issue such as #93.A game's launch options now have a Frame times section, after Mods:
DM_NVN_TSVwithDM_NVN_TSV_CALLS=0(timing rows only) to a new file in<library>/frame-times/<title ID>/, named by the start time.bench.pycounts (nearest-rank percentiles): frames, fps, median, 99 %, slowest frame, frames over 50 ms, dropped frames (@presented_ms−1), and a chart of the frame times with those over 50 ms marked. A long session is thinned for the chart to about 2,000 points, each the slowest of its stretch, so a hitch is never thinned away.Files:
FrameTimes.swift(parsing, summary, files, the switch; no UI),FrameTimesView.swift(one recording),LaunchOptionsView.swift(the section),LauncherView.swift(Play merges the two variables into the launch environment),Localization.swift(both languages). No vendored file is touched.Checked
cd frontend && swift test: 174 tests, 0 failures (2 skipped, as before); newFrameTimesTests(7): the timing rows in frame order with call-count rows and a half-written last line skipped, the summary against hand-counted values, nearest-rank percentiles, the environment, the folder and newest-first listing, off until switched on per game, both languages.NX_LAUNCHER_CAPTURE_DIR=<dir> swift test --filter FrameTimesTestswriteslaunch-options-frame-times.png(the section in the launch options) andlaunch-options-frame-times-rows.png(two recordings with their charts); checked in English.build_ipa_from_nsp.py --platform mac-appon an Apple M2, macOS 27, opened as Play opens it with these two variables for 60 s from start: the host wrote 1,835 frames.FrameTimes.Summaryof that file andbench.py'sframes/pctover it agree exactly: median 14.338 ms, 95 % 21.814, 99 % 30.036, slowest 192.368, 3 dropped.DM_NVN_TSVfile, but the launcher only starts Mac games); the Chinese strings on screen.Scope
dm/,scripts/,docs/,ref/,AGENTS.md) is edited, or it goes through a sync patcher or upstream first (pr-scope)