# NFT-PERF-01 — End-to-end latency p95 budget

**Task**: AZ-428_nft_perf_01_e2e_latency
**Name**: AC-4.1 latency p95 ≤ 400 ms on Tier-2 (Jetson Orin Nano Super) at 25 °C and 50 °C ambient (AC-4.1, D-CROSS-LATENCY-1)
**Description**: Implement NFT-PERF-01 — Tier-2-only; 30 s warm-up + 5 min Derkachi replay at 3 Hz; per-frame latency = `t_emit_at_sitl − t_capture`; record CSV; compute p50/p95/p99; per-stage latency partitioning per D-CROSS-LATENCY-1 table; repeat at +50 °C ambient.
**Complexity**: 5 points
**Dependencies**: AZ-406, AZ-407, AZ-444 (Tier-2 runner)
**Component**: Blackbox Tests / Performance (epic AZ-262)
**Tracker**: AZ-428
**Epic**: AZ-262 (E-BBT)

## Problem

End-to-end latency is the AC-4.1 hard gate; D-CROSS-LATENCY-1 sets a 400 ms p95 budget across two configurations (K=3 baseline at 25 °C, K=2 + Jacobian-cov hybrid at 50 °C). Without measurement on real Jetson hardware these budgets are unverified.

## Outcome

- pytest scenario at `e2e/tests/performance/test_nft_perf_01_e2e_latency.py`. Tier-2 ONLY (skipped on Tier-1 with the documented reason).
- Two configurations measured:
  - (a) K=3 baseline at +25 °C
  - (b) K=2 + Jacobian-cov hybrid auto-degrade at +50 °C ambient (chamber if available, else flagged)
- Per-frame latency CSV; p50/p95/p99 computation; assertion `p95 ≤ 400 ms` per config.
- Per-stage latency partitioning per D-CROSS-LATENCY-1 table (informational only — recorded for trend; not pass/fail).

## Scope

### Included
- Tier-2 entrypoint via `run-tier2.sh`.
- 30 s warm-up + 5 min measurement window.
- Per-frame `t_emit_at_sitl − t_capture` measurement.
- Per-stage partition (C1 OKVIS2 / C2 UltraVPR / C2.5 / C3 / C3.5 / C4 / C4 cov / C5 / serialization / OS jitter) recorded for trend.
- Frame-drop accounting (≤10 % under sustained load per AC-4.1).

### Excluded
- Frame-by-frame inter-emit interval — owned by NFT-PERF-02 (AZ-429).
- Cold-start TTFF — owned by NFT-PERF-03 (AZ-430).
- Spoofing-promotion latency — owned by NFT-PERF-04 (AZ-431).
- The +50 °C chamber portion of AC-NEW-5 — that's a release-gate test handled separately.

## Acceptance Criteria

**AC-1: tier guard**
Given the test is invoked
When `tier == tier1-docker`
Then the test SKIPs with reason `Tier-2 only — Jetson hardware required`.

**AC-2: K=3 baseline @ +25 °C — p95 budget**
Given the K=3 baseline configuration at +25 °C ambient
When the 5 min measurement window completes
Then `p95(t_emit_at_sitl − t_capture) ≤ 400 ms`.

**AC-3: K=2 hybrid @ +50 °C — p95 budget**
Given the K=2 + Jacobian-cov hybrid auto-degrade configuration at +50 °C
When the 5 min measurement window completes
Then `p95 ≤ 400 ms` STILL satisfied (proves D-CROSS-LATENCY-1 effective).

**AC-4: frame-drop allowance**
Given a sustained 5 min run
Then the frame-drop count is ≤10 % of expected emissions (3 Hz × 300 s = 900 expected).

**AC-5: per-stage partition recorded**
Given the partition table (D-CROSS-LATENCY-1)
Then per-stage p95 values are recorded for all named stages; values are emitted into the evidence bundle as `nft-perf-01-partition.csv`. Assertion is informational (no hard threshold).

**AC-6: parameterization**
Given conftest parameterization
Then the scenario runs per `(fc_adapter, vio_strategy)`. Both configurations (a) and (b) run per parameterization.

## System Under Test Boundary

End-to-end on real hardware through public boundaries.

- **Allowed**: SITL-side timestamping at message receipt; `t_capture` from frame source metadata (a public artifact).
- **Forbidden**: instrumenting the SUT internally to read per-component timings; per-stage partitioning relies on what the SUT exposes via `NAMED_VALUE_FLOAT` or FDR (already-public).

## Constraints

- Tier-2 only — invoking on Tier-1 SKIPs.
- Chamber availability for +50 °C is a documented optional environment; absent a chamber, the test runs at workstation ambient and emits a `chamber-unavailable` flag in the evidence.
- Per-stage partition is informational only (no pass/fail threshold).

## Document Dependencies

- `_docs/02_document/tests/performance-tests.md` § NFT-PERF-01
- `_docs/02_document/tests/test-data.md` § Performance (NFT-PERF-01 row)
