fix(perf): fit perf summaries under the sender's limit, no stale or cutscene poses #1383

Merged
HumanBean merged 5 commits from dyst/Longshot:fix/perf-samples-followup into main 2026-11-17 16:02:08 +00:00
Member

Type: fix · Risk: medium · Tested on: Windows 11 (game-free tests only) · Needs: Linux and Windows, any GPU, an in-game run

Why

#1372's per-second samples could lose whole summaries, and could send wrong or more exact data than the docs promise. Above about 300 samples plus a few maps, a summary goes over the launcher's 60 KiB limit, and the launcher deletes it, map totals and all. After going back to the title, samples kept Link's last field position. In a cutscene the camera angles were read from the wrong object, and exact positions left the PC although the docs say only rounded cells do. This follow-up, stacked on #1372 at gab9281's request, fixes the points of the review on #1372. Merge it after #1372, or fold it into it.

See #1372.

What changed

Every summary now fits the sender's limit: the maps' totals always go, and when the samples don't fit, an even spread of them does. Samples carry cell and bin middles, not exact places. The host gives a pose only while it is current and from the gameplay camera, and reads it at most 4 times a second.

  • size (review 1): summary_json() in gpu/vk/perf_report.h fits the samples to kMaxBody (60 KiB, the same as MAX_BODY in nx2/perf_report.py, checked by tests/test_perf_report.py). It counts what the sender's json.dumps adds (sent_size(): non-ASCII becomes \u escapes) and leaves kSenderRoom for the version the sender may fill in. RX_VK_PERF_INTERVAL keeps its 60 to 840 range (840: the relay's 900 s a map); past about five minutes the samples are thinned.
  • stale pose (2): hos_perf_info() in host/hos_main.c gives no pose once it is a second old (PERF_POSE_STALE_NS), and the title block clears it where it clears map_now.
  • camera (3): oot_perf_pose() reads yaw and pitch only when camera zero's view has the gameplay type (0x84c18a88, as the flight and free camera check). A position over 1e6 or an angle over 64 rad counts as no pose.
  • sample gap (4, 7): since_sample is gone. The sample uses since_map's one-second clock, and summarize() finishes the sample only for the last summary (if (now)), so a periodic summary no longer drops up to a second of samples after it.
  • rounding (5): sample_json() sends bin_middle(): the middle of the 100-unit cell and of the 45-degree yaw and 30-degree pitch bins. The wire format is otherwise unchanged; maps are still named.
  • hitch count (6): add_frame() returns whether the frame was a hitch, instead of perf_frame() summing hitch[] twice a frame.
  • rate limit (8): oot_perf_pose() reads the camera's pointers and takes the lock at most every 250 ms (PERF_POSE_EVERY_NS).
  • reuse (9): json_num() calls json_signed_num(std::max(v, 0.0)).
  • docs (10): perf_info and perf_tracking's comments in gpu/vk/vk_api.h give the pose's order and units and when has_pose is 0 (comments only, no ABI change). docs/performance-statistics.md: cells sent by the game, the size limit and thinning, the interval row, the cost. The Graphics guide image's reviewed-source hash advances (docs/images/guide/manifest.json, with a retention note).

Needs checking against Longshot-api: I couldn't read the relay's code. The middles land in the same bin as before only if the relay bins with floor(value / size). If it rounds to the nearest bin, the cells shift by half a cell; change bin_middle() to match it.

Measurements

Verdict: the size, game-free: every summary now fits 60 KiB. Frame cost not measured yet: it must be measured in game before this is ready (see Testing).

Hardware: Windows 11, TDM-GCC 64 (g++ -O2), game-free
Method: summary_json() on the cases below, the sender's re-encoded size (sent_size()); tests/test_perf_report.cpp's add_frame timing

Before: #1372 @ 0cece02 After: this PR @ 36de9b0
5 min, 1 map, 300 samples with decimals 53.4 KB, exact positions 46.4 KB, all 300 samples, cells and bins
840 s, 16 maps every count set, 840 samples 183.8 KB: refused, and deleted 61.0 KB, 239 samples spread over the period
add_frame 9.1 ns 9.0 ns

Flags and settings

None added. RX_VK_PERF_INTERVAL keeps its default (300) and range (60 to 840); past about five minutes its summaries now carry fewer than one sample a second instead of being refused.

Testing

Tested: game-free, on Windows 11 with TDM-GCC.

  • python -I -B tests/test_perf_report.py: every check passes except "a kept connection the relay let go", which fails the same way on main @ 544229a2 on this PC. New checks: the biggest summary fits and keeps every map's totals, samples are thinned evenly, cells and bins instead of exact places, add_frame's result, kMaxBody against MAX_BODY, one clock, the summary keeping the second being sampled, and the host's rate limit, camera type, staleness and title clear.
  • The host's pose code (hos_perf_info, hos_perf_tracking, oot_perf_pose), cut out and compiled with stubs (gcc -Wall -Wextra). It gives no pose while statistics are off, rate-limits reads, gives none once a pose is a second old, none for another camera type or an absurd angle, and none after a clear.
  • python -I -B scripts/check_guide_screenshots.py --review-sources: passes.
  • python -I -B tests/run_all.py (Windows, 24 at once): 524 passed, 79 failed, 118 skipped. main @ 544229a2 on the same PC: 527 passed, 76 failed, 118 skipped. Four files failed only on this branch: test_audio_voice_biquad, test_gpu_hang_watch, test_longshot_ctl and test_portable_builder_startup. Run alone, each behaves the same on both: test_audio_voice_biquad fails on both (a missing file), the other three pass on both. One file, test_prepare_at_build, failed only on main. So these are load-dependent, not regressions. The other failures are this PC's environment (no Vulkan headers, llvm-mingw or spirv-val) and are the same on main.

Not tested: the game itself, and full builds of host/hos_main.c and gpu/vk/perf_report.cpp. This PC has no llvm-mingw or Vulkan headers, and the host's headers come from the game.

Must be tested:

  • Windows, any GPU: build, tick Send performance statistics, point LONGSHOT_PERF_URL at a local relay. Play 6 minutes in Hyrule Field, then go back to the title for a minute. Expect a summary of at most 60 KiB with about 300 samples whose x/y/z are multiples of 100 plus 50, and no samples tagged "Title and intro" (by hand: the summary in perf_sent/).
  • Windows, any GPU: watch a cutscene with the tick on. Expect no samples during it, or plausible angles only (by hand: the summary).
  • Any OS: RX_VK_PERF_INTERVAL=840, visiting several maps (warp songs). Expect the summary sent, not refused: under 60 KiB, every map's totals, samples spread over the period (by hand: the sender's output and perf_sent/).
  • Linux and Windows, any GPU: frame times with the tick off and on, against main, in Hyrule Field. Expect no change in fps or frame times (Test Farm: @Beanstalk linux and windows, five minutes of Hyrule Field with Send performance statistics on and off).

Risks

What could break: fewer samples than one a second in long or many-map summaries (by design); no samples in cutscenes or for the first second after a load; if the relay doesn't bin with floor, the cells shift by half a cell.

Turning it off: untick Send performance statistics; otherwise revert this PR (#1372 stays as it was).

Compatibility: nothing changes beyond #1372. The vk ABI is still MKWVK_API_VERSION 30: only comments in vk_api.h changed. Saves, options and caches are unchanged.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main. (Stacked on #1372 @ 0cece02, which is on main @ 544229a2.)
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here. (Against #1372: its summary_json() makes 183.8 KB of the biggest case and sends exact positions, which the new checks refuse.)
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Not built: no llvm-mingw on this PC.)
  • Docs updated.
**Type:** fix · **Risk:** medium · **Tested on:** Windows 11 (game-free tests only) · **Needs:** Linux and Windows, any GPU, an in-game run ## Why #1372's per-second samples could lose whole summaries, and could send wrong or more exact data than the docs promise. Above about 300 samples plus a few maps, a summary goes over the launcher's 60 KiB limit, and the launcher deletes it, map totals and all. After going back to the title, samples kept Link's last field position. In a cutscene the camera angles were read from the wrong object, and exact positions left the PC although the docs say only rounded cells do. This follow-up, stacked on #1372 at gab9281's request, fixes the points of the review on #1372. Merge it after #1372, or fold it into it. See #1372. ## What changed Every summary now fits the sender's limit: the maps' totals always go, and when the samples don't fit, an even spread of them does. Samples carry cell and bin middles, not exact places. The host gives a pose only while it is current and from the gameplay camera, and reads it at most 4 times a second. - size (review 1): `summary_json()` in `gpu/vk/perf_report.h` fits the samples to `kMaxBody` (60 KiB, the same as `MAX_BODY` in `nx2/perf_report.py`, checked by `tests/test_perf_report.py`). It counts what the sender's `json.dumps` adds (`sent_size()`: non-ASCII becomes `\u` escapes) and leaves `kSenderRoom` for the version the sender may fill in. `RX_VK_PERF_INTERVAL` keeps its 60 to 840 range (840: the relay's 900 s a map); past about five minutes the samples are thinned. - stale pose (2): `hos_perf_info()` in `host/hos_main.c` gives no pose once it is a second old (`PERF_POSE_STALE_NS`), and the title block clears it where it clears `map_now`. - camera (3): `oot_perf_pose()` reads yaw and pitch only when camera zero's view has the gameplay type (`0x84c18a88`, as the flight and free camera check). A position over 1e6 or an angle over 64 rad counts as no pose. - sample gap (4, 7): `since_sample` is gone. The sample uses `since_map`'s one-second clock, and `summarize()` finishes the sample only for the last summary (`if (now)`), so a periodic summary no longer drops up to a second of samples after it. - rounding (5): `sample_json()` sends `bin_middle()`: the middle of the 100-unit cell and of the 45-degree yaw and 30-degree pitch bins. The wire format is otherwise unchanged; maps are still named. - hitch count (6): `add_frame()` returns whether the frame was a hitch, instead of `perf_frame()` summing `hitch[]` twice a frame. - rate limit (8): `oot_perf_pose()` reads the camera's pointers and takes the lock at most every 250 ms (`PERF_POSE_EVERY_NS`). - reuse (9): `json_num()` calls `json_signed_num(std::max(v, 0.0))`. - docs (10): `perf_info` and `perf_tracking`'s comments in `gpu/vk/vk_api.h` give the pose's order and units and when `has_pose` is 0 (comments only, no ABI change). `docs/performance-statistics.md`: cells sent by the game, the size limit and thinning, the interval row, the cost. The Graphics guide image's reviewed-source hash advances (`docs/images/guide/manifest.json`, with a retention note). **Needs checking against Longshot-api:** I couldn't read the relay's code. The middles land in the same bin as before only if the relay bins with `floor(value / size)`. If it rounds to the nearest bin, the cells shift by half a cell; change `bin_middle()` to match it. ## Measurements **Verdict:** the size, game-free: every summary now fits 60 KiB. Frame cost not measured yet: it must be measured in game before this is ready (see Testing). Hardware: Windows 11, TDM-GCC 64 (g++ -O2), game-free Method: `summary_json()` on the cases below, the sender's re-encoded size (`sent_size()`); `tests/test_perf_report.cpp`'s `add_frame` timing | | Before: #1372 @ 0cece02 | After: this PR @ 36de9b0 | |---|---|---| | 5 min, 1 map, 300 samples with decimals | 53.4 KB, exact positions | 46.4 KB, all 300 samples, cells and bins | | 840 s, 16 maps every count set, 840 samples | 183.8 KB: refused, and deleted | 61.0 KB, 239 samples spread over the period | | `add_frame` | 9.1 ns | 9.0 ns | ### Flags and settings None added. `RX_VK_PERF_INTERVAL` keeps its default (300) and range (60 to 840); past about five minutes its summaries now carry fewer than one sample a second instead of being refused. ## Testing **Tested:** game-free, on Windows 11 with TDM-GCC. - `python -I -B tests/test_perf_report.py`: every check passes except "a kept connection the relay let go", which fails the same way on `main` @ 544229a2 on this PC. New checks: the biggest summary fits and keeps every map's totals, samples are thinned evenly, cells and bins instead of exact places, `add_frame`'s result, `kMaxBody` against `MAX_BODY`, one clock, the summary keeping the second being sampled, and the host's rate limit, camera type, staleness and title clear. - The host's pose code (`hos_perf_info`, `hos_perf_tracking`, `oot_perf_pose`), cut out and compiled with stubs (`gcc -Wall -Wextra`). It gives no pose while statistics are off, rate-limits reads, gives none once a pose is a second old, none for another camera type or an absurd angle, and none after a clear. - `python -I -B scripts/check_guide_screenshots.py --review-sources`: passes. - `python -I -B tests/run_all.py` (Windows, 24 at once): 524 passed, 79 failed, 118 skipped. `main` @ 544229a2 on the same PC: 527 passed, 76 failed, 118 skipped. Four files failed only on this branch: `test_audio_voice_biquad`, `test_gpu_hang_watch`, `test_longshot_ctl` and `test_portable_builder_startup`. Run alone, each behaves the same on both: `test_audio_voice_biquad` fails on both (a missing file), the other three pass on both. One file, `test_prepare_at_build`, failed only on `main`. So these are load-dependent, not regressions. The other failures are this PC's environment (no Vulkan headers, llvm-mingw or spirv-val) and are the same on `main`. **Not tested:** the game itself, and full builds of `host/hos_main.c` and `gpu/vk/perf_report.cpp`. This PC has no llvm-mingw or Vulkan headers, and the host's headers come from the game. **Must be tested:** - Windows, any GPU: build, tick Send performance statistics, point `LONGSHOT_PERF_URL` at a local relay. Play 6 minutes in Hyrule Field, then go back to the title for a minute. Expect a summary of at most 60 KiB with about 300 samples whose x/y/z are multiples of 100 plus 50, and no samples tagged "Title and intro" (by hand: the summary in `perf_sent/`). - Windows, any GPU: watch a cutscene with the tick on. Expect no samples during it, or plausible angles only (by hand: the summary). - Any OS: `RX_VK_PERF_INTERVAL=840`, visiting several maps (warp songs). Expect the summary sent, not refused: under 60 KiB, every map's totals, samples spread over the period (by hand: the sender's output and `perf_sent/`). - Linux and Windows, any GPU: frame times with the tick off and on, against `main`, in Hyrule Field. Expect no change in fps or frame times (Test Farm: @Beanstalk linux and windows, five minutes of Hyrule Field with Send performance statistics on and off). ## Risks **What could break:** fewer samples than one a second in long or many-map summaries (by design); no samples in cutscenes or for the first second after a load; if the relay doesn't bin with floor, the cells shift by half a cell. **Turning it off:** untick Send performance statistics; otherwise revert this PR (#1372 stays as it was). **Compatibility:** nothing changes beyond #1372. The vk ABI is still `MKWVK_API_VERSION` 30: only comments in `vk_api.h` changed. Saves, options and caches are unchanged. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [ ] Rebased on current `main`. (Stacked on #1372 @ 0cece02, which is on `main` @ 544229a2.) - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. (Against #1372: its `summary_json()` makes 183.8 KB of the biggest case and sends exact positions, which the new checks refuse.) - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Not built: no llvm-mingw on this PC.) - [x] Docs updated.
feat(telemetry): name the client in crash and perf reports
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 3s
209dee90ea
Crash reports and performance summaries now send `client: Longshot` beside
the game version, so the relay can label every metric by client and by
version separately. The crash window's Send page shows it too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(guides): keep the Graphics image after the perf sample interface (ABI 30)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Guide screenshots / Guide images and local UI source review (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval approved by gab9281 (reviewed)
beanstalk/linux 1/1 fail
beanstalk/windows 1/1 fail
0cece02f72
vk_api.h's perf_info pose outputs and perf_tracking callback change no
pictured row; the reviewed-source hash advances to the inspected file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The launcher's sender refuses a summary over its MAX_BODY (60 KiB) and
deletes it, map totals and all. 300 realistic one-second samples plus a
few maps already passed it, and RX_VK_PERF_INTERVAL=840 made every
summary too big. summary_json now always sends the maps' totals and an
even spread of the samples that fits kMaxBody, counting the bytes the
sender's re-encoding adds (json.dumps escapes non-ASCII).

Each sample's position is sent as the middle of its 100-unit cell and
its yaw and pitch as the middle of their 45- and 30-degree bins, so the
exact place stays on the PC; the relay's floor bins see the same values.

The one-second sample shares since_map's clock, and a periodic summary
keeps the second being sampled instead of dropping up to a second of
frames after it. add_frame returns whether the frame was a hitch, so the
sample doesn't sum the hitch counts twice a frame. json_num reuses
json_signed_num.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(host): no stale or cutscene pose in the perf samples, read 4 times a second
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Guide screenshots / Guide images and local UI source review (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Failing after 5s
36de9b0ce8
Link's pose stayed valid after he stopped updating: back at the title or
the file select, the samples kept his last Hyrule Field position. The
host now stamps the pose and gives none once it is a second old, and
forgets it where the map is cleared at the title.

The yaw and pitch were read from camera zero's view without the type
check the flight and free camera use; in a cutscene that can be another
object. The pose is now read only from the gameplay view type, and a
value no place or angle has counts as no pose.

oot_perf_pose took the exclusive lock and walked the camera's pointers at
every Link update although the samples take the pose once a second: it
now reads it at most every 250 ms.

vk_api.h's perf_info and perf_tracking comments give the pose's order and
units and when has_pose is 0 (comments only); the Graphics guide image's
reviewed-source hash advances with a retention note.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
futondestroyer left a comment

Code-and-evidence review of exact head 36de9b0ce8ab9cb2bea739b025880beef853bd9b, focusing on the two follow-up commits over #1372 at 0cece02. No PR code, tests, builds or game runs executed in this review. This is a WIP review, not merge approval.

No new blocking code defect found in the follow-up. The serializer retains map totals and thins samples to a conservative re-encoded-size budget; UTF-8 expansion is accounted for conservatively, and the ordinary sender's late version insertion has reserved room. Both coordinate and angular values are reduced to bin centers before serialization. The host's camera-type/finite-value checks, update throttling, stale-age check and title clear address the cited stale/wrong-object pose paths. The common one-second clock and preservation of the partial sample through a periodic summary remove the explicit post-summary sampling gap. Returning the hitch decision from add_frame avoids the previous extra counter scans.

Readiness remains limited by the disclosed integration/evidence gaps:

  • The relay's binning contract is not verified. I attempted to read MagicBeanDev/Longshot-api with the existing sign-in and received HTTP 404. Get confirmation or a source-backed contract for floor-based position/yaw/pitch binning, including negative coordinates and angle wrapping, before treating the current bin_middle encoding as wire-compatible. A local collector can validate what is sent but cannot establish the production relay's binning behavior by itself.
  • The size tests exercise generated summary strings and the sender limit constant, but a real sender round trip should verify actual encoded byte count, version insertion and preservation of map totals for the long/many-map case. Verify the enabled host path through title return, cutscene and load transitions; source-string checks alone do not establish those runtime outcomes.
  • Neither full host/renderer builds nor in-game overhead have been validated by the author. The reported full-suite transient differences were rerun separately and disclosed; they should not be presented as successful full runtime coverage. Current forge guide-review and description statuses pass, while Python CI jobs are skipped.
  • Keep the stack relationship explicit: land/fold with 1372 deliberately, then review the actual integration/head. Do not mark ready while applicable build/runtime boxes are incomplete.

Farm suitability: useful for cross-platform compilation and ordinary gameplay smoke coverage, but the documented plan schema does not expose writing the launcher's longshot_perf.ini send=1 opt-in or validating the emitted telemetry payloads. A run with that file absent takes perf_report_init's off path and must not be reported as enabled/disabled overhead coverage. No external relay or telemetry submission should be introduced merely to test it.

Verdict: code looks suitable for local integration validation, with merge approval deferred. Our next step is local enabled-path testing using a loopback-only collector and isolated test settings, retaining game-derived artifacts locally; the user requested that local testing be considered before the farm request, so no farm job has been authorized here. A later Linux/Windows farm build/smoke run remains supplemental and must state exactly which telemetry path was exercised.

Code-and-evidence review of exact head `36de9b0ce8ab9cb2bea739b025880beef853bd9b`, focusing on the two follow-up commits over https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1372 at `0cece02`. No PR code, tests, builds or game runs executed in this review. This is a WIP review, not merge approval. No new blocking code defect found in the follow-up. The serializer retains map totals and thins samples to a conservative re-encoded-size budget; UTF-8 expansion is accounted for conservatively, and the ordinary sender's late version insertion has reserved room. Both coordinate and angular values are reduced to bin centers before serialization. The host's camera-type/finite-value checks, update throttling, stale-age check and title clear address the cited stale/wrong-object pose paths. The common one-second clock and preservation of the partial sample through a periodic summary remove the explicit post-summary sampling gap. Returning the hitch decision from add_frame avoids the previous extra counter scans. Readiness remains limited by the disclosed integration/evidence gaps: - The relay's binning contract is not verified. I attempted to read MagicBeanDev/Longshot-api with the existing sign-in and received HTTP 404. Get confirmation or a source-backed contract for floor-based position/yaw/pitch binning, including negative coordinates and angle wrapping, before treating the current bin_middle encoding as wire-compatible. A local collector can validate what is sent but cannot establish the production relay's binning behavior by itself. - The size tests exercise generated summary strings and the sender limit constant, but a real sender round trip should verify actual encoded byte count, version insertion and preservation of map totals for the long/many-map case. Verify the enabled host path through title return, cutscene and load transitions; source-string checks alone do not establish those runtime outcomes. - Neither full host/renderer builds nor in-game overhead have been validated by the author. The reported full-suite transient differences were rerun separately and disclosed; they should not be presented as successful full runtime coverage. Current forge guide-review and description statuses pass, while Python CI jobs are skipped. - Keep the stack relationship explicit: land/fold with 1372 deliberately, then review the actual integration/head. Do not mark ready while applicable build/runtime boxes are incomplete. Farm suitability: useful for cross-platform compilation and ordinary gameplay smoke coverage, but the documented plan schema does not expose writing the launcher's longshot_perf.ini send=1 opt-in or validating the emitted telemetry payloads. A run with that file absent takes perf_report_init's off path and must not be reported as enabled/disabled overhead coverage. No external relay or telemetry submission should be introduced merely to test it. Verdict: code looks suitable for local integration validation, with merge approval deferred. Our next step is local enabled-path testing using a loopback-only collector and isolated test settings, retaining game-derived artifacts locally; the user requested that local testing be considered before the farm request, so no farm job has been authorized here. A later Linux/Windows farm build/smoke run remains supplemental and must state exactly which telemetry path was exercised.
mooki left a comment

Review of #1383 at head 36de9b0ce (on top of #1372). Changes needed, mostly about what the relay does with the numbers. This answers the open question in the review above (the relay's binning contract): its source is public, and the first two points below come from it.

The size fitting is good. I re-encoded the summaries summary_json makes through the sender's own json.load and json.dumps and all of them stay under 61440 bytes: 16 maps with every count set and 840 samples gives 61042 bytes and 246 samples, 120-byte map names 60993, one map at 300 samples 51130 (all 300 kept). Non-ASCII names and the version and release changes the sender makes fit inside kSenderRoom.

Blocking

  1. Cells (gpu/vk/perf_report.h:193-194, also docs/performance-statistics.md:48). The body says the relay's code could not be read. It is public:
    cell := fmt.Sprintf("x=%.0f,y=%.0f,z=%.0f", math.Round(s.X/100)*100, math.Round(s.Y/100)*100, math.Round(s.Z/100)*100)
    rounds positions to the nearest multiple of 100 (math.Round(x/100)*100), not the floor. The middles the game now sends (50, 150, -50) are exact ties, which Go rounds away from zero, so the cell [0,100) is labelled x=100, [-100,0) x=-100, and x=0 is never produced. In a Python copy of the relay's two functions, 50.2 percent of random positions got a different cell than the relay gives the exact value. Sending the nearest multiple of 100 (std::round(v / kCell) * kCell) fixes it; the angle bins are fine as they are, if the values are radians (next point).
  2. Yaw and pitch (host/hos_main.c:1383-1393, gpu/vk/vk_api.h:271). host/mouse_native.c (lines 1-8, 48) says the camera's yaw and pitch at those offsets are in degrees (yaw wraps at 180, pitch limits -85 to 89), and keeps them on the player camera, while oot_perf_pose reads them from the view at camera+120. The relay refuses the whole summary if any sample has |yaw| over pi or |pitch| over pi/2 (
    }{{"x", -1e9, 1e9}, {"y", -1e9, 1e9}, {"z", -1e9, 1e9}, {"yaw", -math.Pi, math.Pi}, {"pitch", -math.Pi / 2, math.Pi / 2}}
    ), and the sender then deletes it. The host's guard is 64, so degree-sized values pass it: in my copy of the relay, 149 of 150 such poses would get the summary refused, and yaw above 64 gets no pose at all. The guard should be the relay's range, and the angles need to come from the right object in radians. I could not settle the object question without a run.

Should fix

  • The type check is not a cutscene check (host/hos_main.c:1383). Flight (:1455) and host/oot_fov.c:31-33 also test oot_event_playing; a cutscene's camera keeps the same type. Add that test before reading the view.
  • The pose is not tied to the map name (host/hos_main.c:83, :759). A Link update after the title clear sets a pose again and it is served for up to a second under "Title and intro". Return no pose when map[0] is empty in hos_perf_info, and clear it where the map line changes (:769).
  • The tests would not catch these fixes breaking (tests/test_perf_report.cpp:122,148, tests/test_perf_report.py:373-399). The size test measures with sent_size, the function under test: with sent_size counting no escapes, the tests still pass and the real body of the PR's own biggest case is 61970 bytes, which the sender refuses. The host checks are text searches: a pose that is never marked valid also passes. Re-encode the summary in Python for the size, and commit the stub test of the pose code you describe in the body.
  • Longshot-api already raised its limit to 192 KiB (, merged this morning), and nx2/perf_report.py:47 still says 64 KiB. Raising the sender's MAX_BODY would keep all 840 samples; keeping 60 KiB works with the old relay too. Your call and the maintainers', but the comment and the text should say which.
  • README.md:777 still says the relay rounds positions and angles.

Nit: the even thinning drops the hitch seconds as readily as the quiet ones; keep the seconds with hitches first.

What I ran (Linux, game-free): tests/test_perf_report.py passes. The 88 checks that read the changed files plus the C++ unit tests give 86 passed and 6 failed, the same six that fail on #1372's head (test_display_startup_failure, test_hud_layout_row, test_profiling_mode, test_rumble_menu, test_slow_frames, test_walk_key). The Windows-target syntax check fails on both heads with the same "define _CRT_SECURE_NO_WARNINGS before the first include" for test_perf_report.cpp, a line that is on main too. The guide screenshot source check passes. I broke single lines of the fix in scratch copies: five of nine changes were not caught by the tests (list in my notes). The relay's behaviour was checked with a Python copy of its code; Go is not installed here.

Not run: the game, any Windows run, a build of the host file, the whole suite, the relay's own tests.

A Linux run is needed: the angles in perf_pending/ against the control bridge's camera value while turning the camera, a summary sent to a real relay and accepted, a trip back to the title, a cutscene and a pause with no pose samples, and frame times with the tick off and on against main.

Review of https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1383 at head 36de9b0ce (on top of https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1372). Changes needed, mostly about what the relay does with the numbers. This answers the open question in the review above (the relay's binning contract): its source is public, and the first two points below come from it. The size fitting is good. I re-encoded the summaries `summary_json` makes through the sender's own `json.load` and `json.dumps` and all of them stay under 61440 bytes: 16 maps with every count set and 840 samples gives 61042 bytes and 246 samples, 120-byte map names 60993, one map at 300 samples 51130 (all 300 kept). Non-ASCII names and the version and release changes the sender makes fit inside `kSenderRoom`. **Blocking** 1. Cells (`gpu/vk/perf_report.h:193-194`, also `docs/performance-statistics.md:48`). The body says the relay's code could not be read. It is public: https://git.magicbean.dev/MagicBeanDev/DataServicesAPI/src/commit/eadbca4c0bb47a9e128f4c314cf2a9c9916fec15/telemetry/perf/totals.go#L205 rounds positions to the nearest multiple of 100 (`math.Round(x/100)*100`), not the floor. The middles the game now sends (50, 150, -50) are exact ties, which Go rounds away from zero, so the cell [0,100) is labelled `x=100`, [-100,0) `x=-100`, and `x=0` is never produced. In a Python copy of the relay's two functions, 50.2 percent of random positions got a different cell than the relay gives the exact value. Sending the nearest multiple of 100 (`std::round(v / kCell) * kCell`) fixes it; the angle bins are fine as they are, if the values are radians (next point). 2. Yaw and pitch (`host/hos_main.c:1383-1393`, `gpu/vk/vk_api.h:271`). `host/mouse_native.c` (lines 1-8, 48) says the camera's yaw and pitch at those offsets are in degrees (yaw wraps at 180, pitch limits -85 to 89), and keeps them on the player camera, while `oot_perf_pose` reads them from the view at camera+120. The relay refuses the whole summary if any sample has |yaw| over pi or |pitch| over pi/2 (https://git.magicbean.dev/MagicBeanDev/DataServicesAPI/src/commit/eadbca4c0bb47a9e128f4c314cf2a9c9916fec15/telemetry/perf/summary.go#L471), and the sender then deletes it. The host's guard is 64, so degree-sized values pass it: in my copy of the relay, 149 of 150 such poses would get the summary refused, and yaw above 64 gets no pose at all. The guard should be the relay's range, and the angles need to come from the right object in radians. I could not settle the object question without a run. **Should fix** - The type check is not a cutscene check (`host/hos_main.c:1383`). Flight (`:1455`) and `host/oot_fov.c:31-33` also test `oot_event_playing`; a cutscene's camera keeps the same type. Add that test before reading the view. - The pose is not tied to the map name (`host/hos_main.c:83`, `:759`). A Link update after the title clear sets a pose again and it is served for up to a second under "Title and intro". Return no pose when `map[0]` is empty in `hos_perf_info`, and clear it where the map line changes (`:769`). - The tests would not catch these fixes breaking (`tests/test_perf_report.cpp:122,148`, `tests/test_perf_report.py:373-399`). The size test measures with `sent_size`, the function under test: with `sent_size` counting no escapes, the tests still pass and the real body of the PR's own biggest case is 61970 bytes, which the sender refuses. The host checks are text searches: a pose that is never marked valid also passes. Re-encode the summary in Python for the size, and commit the stub test of the pose code you describe in the body. - Longshot-api already raised its limit to 192 KiB (https://git.magicbean.dev/MagicBeanDev/DataServicesAPI/src/commit/eadbca4c0bb47a9e128f4c314cf2a9c9916fec15/telemetry/perf/summary.go#L44, merged this morning), and `nx2/perf_report.py:47` still says 64 KiB. Raising the sender's `MAX_BODY` would keep all 840 samples; keeping 60 KiB works with the old relay too. Your call and the maintainers', but the comment and the text should say which. - `README.md:777` still says the relay rounds positions and angles. **Nit:** the even thinning drops the hitch seconds as readily as the quiet ones; keep the seconds with hitches first. **What I ran** (Linux, game-free): `tests/test_perf_report.py` passes. The 88 checks that read the changed files plus the C++ unit tests give 86 passed and 6 failed, the same six that fail on #1372's head (`test_display_startup_failure`, `test_hud_layout_row`, `test_profiling_mode`, `test_rumble_menu`, `test_slow_frames`, `test_walk_key`). The Windows-target syntax check fails on both heads with the same "define `_CRT_SECURE_NO_WARNINGS` before the first include" for `test_perf_report.cpp`, a line that is on main too. The guide screenshot source check passes. I broke single lines of the fix in scratch copies: five of nine changes were not caught by the tests (list in my notes). The relay's behaviour was checked with a Python copy of its code; Go is not installed here. **Not run:** the game, any Windows run, a build of the host file, the whole suite, the relay's own tests. A Linux run is needed: the angles in `perf_pending/` against the control bridge's camera value while turning the camera, a summary sent to a real relay and accepted, a trip back to the title, a cutscene and a pause with no pose samples, and frame times with the tick off and on against main.
gab9281 changed title from WIP: fix(perf): fit perf summaries under the sender's limit, no stale or cutscene poses to fix(perf): fit perf summaries under the sender's limit, no stale or cutscene poses 2026-11-17 15:15:30 +00:00
HumanBean deleted branch fix/perf-samples-followup 2026-11-17 16:02:09 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1383
No description provided.