[pr-diagnostics][performance] Check the common coverage of two frame CSVs #230

Open
superhero-520 wants to merge 2 commits from superhero-520/Darner:bench-frame-csv-coverage into main
First-time contributor

Contributor role (optional)

Role already held.

What it changes

A missing interior CSV row can leave a benchmark report looking usable even when the writer reports zero losses. A recording can also end before the requested comparison window. This adds an offline checker for the A/B procedure discussed in #152.

Give the checker the CSV from each run, the timestamp of the same event in each, and one duration. It reports the common time range, complete frame intervals, host-row gaps and writer loss for each run. Missing counters are reported as unknown. A sample command for a 10-second comparison is:

python scripts/check-frame-csv-coverage.py A.csv B.csv --start-a-ms 60000 --start-b-ms 60000 --duration-ms 10000

How it was tested

  • Current head 6d9e99d2d9487340f1174a9d295e276190351cc5: all 9 Python tests passed, and the asset-policy check passed for 555 files. A zero-duration row tied at the end of the window now reports one missing host row and one writer loss (exit 1). Moving that row past the endpoint keeps the control clear (exit 0). The 60–70 s bench-kit replay gave 102/102 complete intervals for the intact pair and 102/101 after removing host row 15112. The Rust gate results below were measured on the preceding revision.
  • Revision 3a89c9b5e4000352eb9974d6453ea7473a0b00f0, based on f3840d73d3504c30218debfbc8795b9225447317. All 8 Python tests passed with python -B -m unittest discover -s tests -v.
  • The supplied bench-kit sample has 200 rows and 110 columns. Its first and last timestamps bracket 199 complete frame intervals. Comparing the intact sample with itself over 60–70 seconds gave 102 complete intervals per side and exit 0.
  • Removing host row 15112 from a temporary copy gave 102 versus 101 complete intervals, one missing host row, zero reported writer losses and exit 1. Cutting the copy short reduced the common window by 263.741 ms. Removing its loss-counter column reported unknown.
  • Synthetic cases cover legacy headers, unequal start times, clock resets, losses on the window boundary and malformed input.
  • Both workspace Clippy gates and cargo xtask policy passed. cargo test --workspace --locked stopped in darner-gpu with 1,772 passed and one failure in watch::tests::ask_once_by_res_splits_reservations_without_refusals. The same assertion at watch.rs:8614 also failed on clean main. Open PR #150 changes the assertion that failed here. The same #230 test binary passed that test in isolation.
  • Offline diagnostics only. No gameplay or speed measurement was needed.

Checklist

  • Exercised the tool on an archived CSV and temporary controls.
  • One change based on main.
  • The diff follows docs/asset-policy.md.
  • Depends on: none.

Checked for overlap

  • Searched open and closed issues, pull requests and related discussions.
  • #152 documents the A/B procedure. #172 handles frame-time batches in text logs. This PR checks paired per-frame CSV files. No duplicate implementation found.
## Contributor role (optional) Role already held. ## What it changes A missing interior CSV row can leave a benchmark report looking usable even when the writer reports zero losses. A recording can also end before the requested comparison window. This adds an offline checker for the A/B procedure discussed in #152. Give the checker the CSV from each run, the timestamp of the same event in each, and one duration. It reports the common time range, complete frame intervals, host-row gaps and writer loss for each run. Missing counters are reported as unknown. A sample command for a 10-second comparison is: `python scripts/check-frame-csv-coverage.py A.csv B.csv --start-a-ms 60000 --start-b-ms 60000 --duration-ms 10000` ## How it was tested - Current head `6d9e99d2d9487340f1174a9d295e276190351cc5`: all 9 Python tests passed, and the asset-policy check passed for 555 files. A zero-duration row tied at the end of the window now reports one missing host row and one writer loss (exit 1). Moving that row past the endpoint keeps the control clear (exit 0). The 60–70 s bench-kit replay gave 102/102 complete intervals for the intact pair and 102/101 after removing host row 15112. The Rust gate results below were measured on the preceding revision. - Revision `3a89c9b5e4000352eb9974d6453ea7473a0b00f0`, based on `f3840d73d3504c30218debfbc8795b9225447317`. All 8 Python tests passed with `python -B -m unittest discover -s tests -v`. - The supplied bench-kit sample has 200 rows and 110 columns. Its first and last timestamps bracket 199 complete frame intervals. Comparing the intact sample with itself over 60–70 seconds gave 102 complete intervals per side and exit 0. - Removing host row 15112 from a temporary copy gave 102 versus 101 complete intervals, one missing host row, zero reported writer losses and exit 1. Cutting the copy short reduced the common window by 263.741 ms. Removing its loss-counter column reported unknown. - Synthetic cases cover legacy headers, unequal start times, clock resets, losses on the window boundary and malformed input. - Both workspace Clippy gates and `cargo xtask policy` passed. `cargo test --workspace --locked` stopped in `darner-gpu` with 1,772 passed and one failure in `watch::tests::ask_once_by_res_splits_reservations_without_refusals`. The same assertion at `watch.rs:8614` also failed on clean main. Open PR #150 changes the assertion that failed here. The same #230 test binary passed that test in isolation. - Offline diagnostics only. No gameplay or speed measurement was needed. ## Checklist - [x] Exercised the tool on an archived CSV and temporary controls. - [x] One change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] Depends on: none. ## Checked for overlap - [x] Searched open and closed issues, pull requests and related discussions. - #152 documents the A/B procedure. #172 handles frame-time batches in text logs. This PR checks paired per-frame CSV files. No duplicate implementation found.
First-time contributor

I ran 3a89c9b5 against the four full gameplay CSVs used in #209. Each 45-second window starts 55 seconds after the first world frame. I mapped that event into each file’s elapsed clock using the nearest timestamped row.

Release .02 runs Start A / B (ms) Complete intervals A / B Exit
A2 / B2 105357.828 / 106668.540 1401 / 1595 0
A3 / B3 104613.555 / 103657.334 1633 / 1565 0

All four counts match the independently exported rows exactly (6,194 total). All four showed zero missing host rows, writer losses and timing breaks.

For a negative control I removed one interior row in a copy of A2 and set rows_lost=1 on its successor. The same 45-second request returned 1, with 1,400 A frames, one missing host row and one writer loss. A one-second window starting at the surviving row’s end returned 0. Asking for two seconds with only one second left in A returned 1 and reported the one-second overlap. These checks cover recording continuity. The draw-count difference between A3 and B3 still matters for any speed comparison.

Tested with Codex assistance.

I ran `3a89c9b5` against the four full gameplay CSVs used in [#209](https://git.gtahub.st/TrustNo1/Darner/issues/209#issuecomment-861126). Each 45-second window starts 55 seconds after the first world frame. I mapped that event into each file’s elapsed clock using the nearest timestamped row. | Release .02 runs | Start A / B (ms) | Complete intervals A / B | Exit | |---|---:|---:|---:| | A2 / B2 | 105357.828 / 106668.540 | 1401 / 1595 | 0 | | A3 / B3 | 104613.555 / 103657.334 | 1633 / 1565 | 0 | All four counts match the independently exported rows exactly (6,194 total). All four showed zero missing host rows, writer losses and timing breaks. For a negative control I removed one interior row in a copy of A2 and set `rows_lost=1` on its successor. The same 45-second request returned 1, with 1,400 A frames, one missing host row and one writer loss. A one-second window starting at the surviving row’s end returned 0. Asking for two seconds with only one second left in A returned 1 and reported the one-second overlap. These checks cover recording continuity. The draw-count difference between A3 and B3 still matters for any speed comparison. Tested with Codex assistance.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'bench-frame-csv-coverage:superhero-520-bench-frame-csv-coverage'
git switch 'superhero-520-bench-frame-csv-coverage'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'superhero-520-bench-frame-csv-coverage'
git switch 'superhero-520-bench-frame-csv-coverage'
git rebase 'main'
git switch 'main'
git merge --ff-only 'superhero-520-bench-frame-csv-coverage'
git switch 'superhero-520-bench-frame-csv-coverage'
git rebase 'main'
git switch 'main'
git merge --no-ff 'superhero-520-bench-frame-csv-coverage'
git switch 'main'
git merge --squash 'superhero-520-bench-frame-csv-coverage'
git switch 'main'
git merge --ff-only 'superhero-520-bench-frame-csv-coverage'
git switch 'main'
git merge 'superhero-520-bench-frame-csv-coverage'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 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
TrustNo1/Darner!230
No description provided.