# 时序与延迟

> 本页由仓库源文件生成。请不要直接编辑本页；修改下方 source 文件后运行 `vp run docs:generate`。

> 中文支持说明：本页是中文站点镜像，保留论文标题、证据状态和来源字段的原始表述，避免未经核实的翻译改变证据边界。

> 来源: `system/timing-and-latency.md`

## Timing And Latency

Status: `runtime binding draft`

Timing fields should be logged through the runtime records in `system/runtime-interfaces.md` and the trial log schema in `experiments/templates/trial-log-schema.md`.

## Timebase Rule

Use `monotonic_ns` as the primary timebase for latency analysis. Use `wall_time_iso8601` only for human-readable audit trails. Evidence-producing multi-host sessions require a synchronization record that states the method, devices involved, estimated error bound, and failure rule.

## Timing Budget To Measure

| Segment | Metric |
| --- | --- |
| camera frame to YOLO output | detection latency |
| YOLO output to candidate freeze | candidate management latency |
| stimulus onset to EEG marker | sync latency |
| EEG window to SSVEP output | decoding latency |
| MI cue/window to mode command | decoding latency |
| fusion decision to robot command | control latency |
| robot plan to first movement | planning latency |
| approach to grasp completion | execution time |

## Latency Derivation

| Segment | Start Record | End Record | Required Output |
| --- | --- | --- | --- |
| detection latency | `VisionFrame.monotonic_ns` | `ObjectDetection.monotonic_ns` | per-frame detector latency |
| candidate freeze latency | latest input detection | `CandidateFreezeSet.monotonic_ns` | candidate-manager latency |
| stimulus sync latency | `StimulusBinding.monotonic_ns` | linked EEG marker/window start | stimulus-to-EEG sync estimate |
| SSVEP decoding latency | `EEGWindow` end time | `SSVEPDecision.monotonic_ns` | decoder latency |
| MI decoding latency | `EEGWindow` end time | `MIDecision.monotonic_ns` | decoder latency |
| fusion latency | latest accepted decoder decision | `FusedIntent.monotonic_ns` | arbitration latency |
| planning latency | `FusedIntent.monotonic_ns` | `RobotPlan.monotonic_ns` | planner latency |
| execution time | `RobotExecution.started_at` | `RobotExecution.ended_at` | robot execution time |

Hardware details are not yet known. Record EEG sampling rate, display refresh rate, camera frame rate, robot control period, and timestamp synchronization method before experiments.

Clock synchronization method and middleware logging behavior must be frozen in `experiments/pre-data-freeze-checklist.md`.
