Requirement
Derived from #48 (REQ-F-IOCTL-XSTAMP-001) performance requirements:
| Metric |
Target |
| Correlation Jitter |
<2µs σ (standard deviation across 1000 samples) |
| PHC-QPC Capture Skew |
<5µs |
Background
The cross-timestamp IOCTL returns a (phc_time_ns, system_qpc) pair captured at
approximately the same instant. The "correlation jitter" measures how consistently
the offset phc_time_ns - qpc_equivalent_ns is computed across 1000 samples — low
jitter means the capture window is stable and the correlation can be trusted.
qpc_equivalent_ns = (system_qpc - qpc_ref) * 1e9 / qpc_frequency
Method
- Collect 1000
(phc_ns, qpc_ticks) pairs via 1000 IOCTL_AVB_PHC_CROSSTIMESTAMP calls
- Convert each QPC tick to nanoseconds using
qpc_frequency
- Compute offset for each sample:
offset_i = phc_ns_i - qpc_ns_i
- Compute mean offset and standard deviation σ
- Assert σ < 2000 ns (2µs)
The offset mean represents the PHC-to-wall-clock delta; the σ represents jitter in the
capture window. A large σ means the two reads (PHC and QPC) are taken far apart in time,
making correlation unreliable.
Test Cases
TC-XSTAMP-JIT-001a: Correlation jitter σ < 2µs over 1000 samples
Preconditions: Driver loaded, handle open, PHC running at nominal rate.
Steps:
- Allocate
offset_ns[1000]
- For i = 0..999:
a. Call IOCTL_AVB_PHC_CROSSTIMESTAMP → (phc_ns, qpc_ticks, qpc_freq)
b. qpc_ns = qpc_ticks * 1e9 / qpc_freq
c. offset_ns[i] = phc_ns - qpc_ns
- Compute
mean = average(offset_ns[])
- Compute
sigma = sqrt(sum((offset_ns[i] - mean)^2) / 1000)
- Report sigma in nanoseconds
Acceptance Criterion: sigma < 2000 ns (2µs) per REQ-F-IOCTL-XSTAMP-001
TC-XSTAMP-JIT-001b: PHC-QPC capture bracket < 5µs (estimated)
The driver samples PHC and QPC sequentially (no hardware-atomic path).
We estimate the capture window by bracketing the entire IOCTL with QPC
and comparing to the returned phc_time_ns delta over two consecutive calls.
Steps:
QPC_before → IOCTL call 1 → QPC_after
- Record
ioctl_window_ns = (QPC_after - QPC_before) * 1e9 / qpc_freq
- Repeat 100 times, report median
Acceptance Criterion: Median IOCTL window < 5µs (proxy for PHC-QPC skew)
Note: The current AVB_CROSS_TIMESTAMP_REQUEST struct does NOT include a
CaptureLatencyNs field as specified in REQ-F-IOCTL-XSTAMP-001 §Output Structure.
This test uses IOCTL window as a proxy. A driver enhancement to add CaptureLatencyNs
to the struct is needed to directly verify this criterion. This test is expected to PASS
as a proxy; the missing field is a separate driver gap.
Acceptance Criteria Summary
Implementation
- New test file:
tests/integration/ptp/ptp_ioctl_latency_test.c
Traceability
Requirement
Derived from #48 (REQ-F-IOCTL-XSTAMP-001) performance requirements:
Background
The cross-timestamp IOCTL returns a
(phc_time_ns, system_qpc)pair captured atapproximately the same instant. The "correlation jitter" measures how consistently
the offset
phc_time_ns - qpc_equivalent_nsis computed across 1000 samples — lowjitter means the capture window is stable and the correlation can be trusted.
qpc_equivalent_ns = (system_qpc - qpc_ref) * 1e9 / qpc_frequencyMethod
(phc_ns, qpc_ticks)pairs via 1000IOCTL_AVB_PHC_CROSSTIMESTAMPcallsqpc_frequencyoffset_i = phc_ns_i - qpc_ns_iThe offset mean represents the PHC-to-wall-clock delta; the σ represents jitter in the
capture window. A large σ means the two reads (PHC and QPC) are taken far apart in time,
making correlation unreliable.
Test Cases
TC-XSTAMP-JIT-001a: Correlation jitter σ < 2µs over 1000 samples
Preconditions: Driver loaded, handle open, PHC running at nominal rate.
Steps:
offset_ns[1000]a. Call
IOCTL_AVB_PHC_CROSSTIMESTAMP→(phc_ns, qpc_ticks, qpc_freq)b.
qpc_ns = qpc_ticks * 1e9 / qpc_freqc.
offset_ns[i] = phc_ns - qpc_nsmean = average(offset_ns[])sigma = sqrt(sum((offset_ns[i] - mean)^2) / 1000)Acceptance Criterion:
sigma < 2000 ns(2µs) per REQ-F-IOCTL-XSTAMP-001TC-XSTAMP-JIT-001b: PHC-QPC capture bracket < 5µs (estimated)
The driver samples PHC and QPC sequentially (no hardware-atomic path).
We estimate the capture window by bracketing the entire IOCTL with QPC
and comparing to the returned
phc_time_nsdelta over two consecutive calls.Steps:
QPC_before→ IOCTL call 1 →QPC_afterioctl_window_ns = (QPC_after - QPC_before) * 1e9 / qpc_freqAcceptance Criterion: Median IOCTL window < 5µs (proxy for PHC-QPC skew)
Note: The current
AVB_CROSS_TIMESTAMP_REQUESTstruct does NOT include aCaptureLatencyNsfield as specified in REQ-F-IOCTL-XSTAMP-001 §Output Structure.This test uses IOCTL window as a proxy. A driver enhancement to add
CaptureLatencyNsto the struct is needed to directly verify this criterion. This test is expected to PASS
as a proxy; the missing field is a separate driver gap.
Acceptance Criteria Summary
IOCTL_AVB_PHC_CROSSTIMESTAMPcalls returnvalid == 1CaptureLatencyNsfield verification not possible without driver struct update (REQ-F-IOCTL-XSTAMP-001: Cross-Timestamp Query (PHC + System Time) #48 gap)Implementation
tests/integration/ptp/ptp_ioctl_latency_test.cTraceability