# HPT USB CSV buffer-window tuning acceptance

Status: complete
Type: evidence
Updated: 2026-08-01
Next Action: none; the final A/B Graph and export operator review passed in the successor evidence

Parent: work/wp/completed/wp-tune-hpt-usb-csv-buffer-window.md
Predecessor: work/evidence/hpt-usb-csv-buffered-publication-20260726.md
Canonical Truth: docs/sd-card-operation-and-recovery.md

## Result

The bounded HPT CSV publication buffer was increased from 8 KiB to 32 KiB,
then built and qualified on Controller B first and Controller A second. The
32 KiB image is selected and remains installed on both controls.

Both real retained-range exports completed the temporary-file, count, trailer,
close, first media flush, rename, and final media-flush sequence. Each export
used three complete-row writes with no gaps, errors, fallbacks, or dropped
logs.

| Metric | Controller A | Controller B |
| --- | ---: | ---: |
| Customer filename | `SMI6_07162026_20260725t0836-20260726t1444.csv` | `SMI7_00112233_20260725t0911-20260726t1442.csv` |
| Records scanned / selected | `1,830 / 1,828` | `1,780 / 1,775` |
| Healthy / degraded | `1,828 / 0` | `1,694 / 81` |
| Snapshot / requested gaps | `0 / 0` | `0 / 0` |
| HPT staging | `2.33 s` | `2.22 s` |
| USB publication | `0.45 s` | `2.04 s` |
| Total end to end | `2.82 s` | `4.29 s` |
| Row construction | `0.24 s` | `0.27 s` |
| File writes | `0.16 s` | `0.69 s` |
| Close / both flushes / rename | `0.01 / 0.01 / 0.03 s` | `0.00 / 0.55 / 0.04 s` |
| File write calls | `3` | `3` |
| Bytes requested | `92,464` | `89,798` |
| Largest write / buffer | `32,759 / 32,768 B` | `32,759 / 32,768 B` |
| Complete / published | `1 / 1` | `1 / 1` |
| HPT / USB status | `0 / 0` | `0 / 0` |

## Performance disposition

Comparisons use elapsed time per selected record so the changing live record
counts do not bias the result.

| Comparison | Controller A | Controller B |
| --- | ---: | ---: |
| 32 KiB versus accepted 8 KiB, USB throughput | `1.434x` | `1.176x` |
| 32 KiB versus accepted 8 KiB, end-to-end throughput | `1.062x` | `1.076x` |
| 32 KiB versus original row writer, USB throughput | `48.97x` | `16.13x` |
| 32 KiB versus original row writer, end-to-end throughput | `8.66x` | `8.20x` |

The remaining B penalty is media-dependent: its mandatory durable media
flushes consumed `0.55 s`, compared with `0.01 s` on A, and its three FileX
writes consumed `0.69 s`, compared with `0.16 s` on A. Increasing the window
again would save at most two write calls for these approximately 90 KiB files
while increasing static RAM pressure and individual blocking-transfer size.
FAT preallocation would add allocation and recovery complexity without
removing the mandatory close/flush/rename durability costs. Neither change is
accepted for this pass.

## Long-range projections

These projections scale each control's measured per-record time to one-minute
logging. They are not direct 30- or 90-day exports and are dependent on the USB
media.

| Control | Range | Records | HPT staging | USB publication | Total |
| --- | ---: | ---: | ---: | ---: | ---: |
| A | 30 days | `43,200` | `55.1 s` | `10.6 s` | `1.11 min` |
| A | 90 days | `129,600` | `2.75 min` | `0.53 min` | `3.33 min` |
| B | 30 days | `43,200` | `54.0 s` | `49.6 s` | `1.74 min` |
| B | 90 days | `129,600` | `2.70 min` | `2.48 min` | `5.22 min` |

The conservative observed-media estimate for a 90-day export is therefore
approximately `5.22 min`.

## Candidate, memory, and software gates

- Debug S-record SHA-256:
  `35B020FDBDF2E02E0ACD96E83A261917A11F5EE48DB24058FB98450F6A956B4F`
- Debug ELF SHA-256:
  `F35736DEAB1600E145F6C155B2B4A961591A8850FF4F2566F34D498079AB7081`
- Debug map SHA-256:
  `CE3A508044C7973BB209324167C4B785F016C78C0D37DCFAF47DE427385A6DED`
- Production-name package: `7520553_SMI_FW_00_05_00`
- Repository check suites: `21/21 PASS`
- Python model suites: `8/8 PASS`
- Python compilation gate: PASS
- Managed isolated clean Debug build and package: PASS
- `gHptExportStatus` layout: `0xF8`, confirmed from the candidate ELF
- Buffer: statically allocated, 32-bit aligned, bounded to `32,768 B`;
  complete-row buffering and oversize direct-write fallback remain enforced
- Linked RAM region: `0x1FFE0000` through `0x2007FFFF` (`640 KiB`)
- Linked sections: `.data 16,828 B`, `.bss 554,460 B`, reserved
  `.heap 38,912 B`, and reserved `.stack_dummy 25,600 B`
- The last reserved stack byte ends at `0x2007B5C7`, leaving `19,000 B`
  (`18.6 KiB`) of linker-address headroom

The remaining headroom is after the configured heap and stacks have already
been reserved. The 32 KiB candidate therefore fits the exact target link and
passed both live targets; larger buffers are not accepted without a new memory
and blocking-latency qualification.

## Identity and preservation

| Control | Assembly / J-Link | Protocol / CID-valid / representative read | Card identity |
| --- | --- | --- | --- |
| A | `1751136 / 69664082` | `6 / 1 / 0` | SanDisk/WD, MID `0x03`, OEM `SD`, product `SS08G`, revision `8.0`, serial `2540634244`, manufactured `2024-05`, raw CID `035344535330384780976F0084018559` |
| B | `1751219 / 69660123` | `6 / 1 / 0` | SanDisk/WD, MID `0x03`, OEM `SD`, product `SS08G`, revision `8.0`, serial `2540634245`, manufactured `2024-05`, raw CID `035344535330384780976F0085018507` |

Baseline and post-export captures show unchanged CIDs, zero system errors,
dropped logs, mirror mismatches, or lost records. A remains aligned with lane
oldest starts `1 / 1 / 1`, active starts `1024 / 1024 / 1024`, and no
retirements. B was not formatted or normalized: it retains oldest starts
`86 / 86 / 1`, active starts `1109 / 1109 / 1024`, and retirements
`2 / 1 / 0`.

No SD format, initialization, card replacement, powered removal, or
configuration mutation occurred.

Boot cache timing on the exact image was:

- A: `2.11 s` traversal, `2.96 s` complete elapsed;
- B: `2.06 s` traversal, `2.87 s` complete elapsed.

## Operator-visible end state

Both Graph screens were reopened with RAM-only review commands and captured
active on the exact selected image. Both follow newest, have current rendered
sequences, and have zero chart-newest-to-viewport-edge lag. At final capture,
A's newest record was `20 s` behind RTC and B's was `39 s` behind RTC, within
the one-minute logging cadence.

## Raw captures

- A:
  `work/evidence/hpt-log-store-circular-mirror/controller-a/usb-buffer-window-32k-20260726/`
- B:
  `work/evidence/hpt-log-store-circular-mirror/controller-b/usb-buffer-window-32k-20260726/`

The compact JSON files are the review surface. Binary target captures remain
supporting evidence and should not be reviewed through per-file diffs.
