Requirement
Derived from #149 (REQ-F-PTP-001) acceptance criteria:
Get Clock Time (IOCTL_AVB_GET_CLOCK_TIME):
- Latency: <5µs (from IOCTL dispatch to register read)
Set Clock Time (IOCTL_AVB_SET_CLOCK_TIME):
Test Objective
Measure the round-trip latency of IOCTL_AVB_GET_TIMESTAMP and IOCTL_AVB_SET_TIMESTAMP
from user-mode DeviceIoControl call start to return, and verify the P50 is within the
latency budget defined in REQ-F-PTP-001.
Method
Use QueryPerformanceCounter bracketing around each DeviceIoControl call.
Collect 1000 samples. Compute P50, P95, P99.
The measurement includes kernel-transition overhead (unavoidable from user-mode).
Test Cases
TC-PTP-LAT-001a: GET_TIMESTAMP P50 latency < 5µs
Preconditions: Driver loaded, handle open, PHC running.
Steps:
- Call
QueryPerformanceCounter → t0
- Call
DeviceIoControl(IOCTL_AVB_GET_TIMESTAMP)
- Call
QueryPerformanceCounter → t1
- Record
latency_us = (t1 - t0) / freq * 1e6
- Repeat 1000 times
- Sort; extract P50
Acceptance Criterion: P50 < 5µs (REQ-F-PTP-001 §1)
Expected Status: ⚠️ May fail — kernel-transition from user-mode typically adds 1–3µs;
whether the total stays < 5µs depends on system load and driver implementation.
TC-PTP-LAT-001b: SET_TIMESTAMP P50 latency < 10µs
Steps:
- Bracket
DeviceIoControl(IOCTL_AVB_SET_TIMESTAMP) with QPC
- Repeat 100 times (write operations; destructive to PHC state)
- Extract P50
Acceptance Criterion: P50 < 10µs (REQ-F-PTP-001 §2)
TC-PTP-LAT-001c: GET_TIMESTAMP returns non-zero incrementing value
Steps:
- Read PHC at t=0
- Sleep 100 ms
- Read PHC at t=1
- Assert
phc_t1 > phc_t0
Acceptance Criterion: PHC is running (monotonically incrementing)
Acceptance Criteria Summary
- ✅
IOCTL_AVB_GET_TIMESTAMP P50 latency < 5µs over 1000 calls
- ✅
IOCTL_AVB_SET_TIMESTAMP P50 latency < 10µs over 100 calls
- ✅ PHC timestamp monotonically increases between calls
Implementation
- New test file:
tests/integration/ptp/ptp_ioctl_latency_test.c
- Build target:
ptp_ioctl_latency_test
Traceability
Requirement
Derived from #149 (REQ-F-PTP-001) acceptance criteria:
Test Objective
Measure the round-trip latency of
IOCTL_AVB_GET_TIMESTAMPandIOCTL_AVB_SET_TIMESTAMPfrom user-mode
DeviceIoControlcall start to return, and verify the P50 is within thelatency budget defined in REQ-F-PTP-001.
Method
Use
QueryPerformanceCounterbracketing around eachDeviceIoControlcall.Collect 1000 samples. Compute P50, P95, P99.
The measurement includes kernel-transition overhead (unavoidable from user-mode).
Test Cases
TC-PTP-LAT-001a: GET_TIMESTAMP P50 latency < 5µs
Preconditions: Driver loaded, handle open, PHC running.
Steps:
QueryPerformanceCounter→t0DeviceIoControl(IOCTL_AVB_GET_TIMESTAMP)QueryPerformanceCounter→t1latency_us = (t1 - t0) / freq * 1e6Acceptance Criterion:
P50 < 5µs(REQ-F-PTP-001 §1)Expected Status:⚠️ May fail — kernel-transition from user-mode typically adds 1–3µs;
whether the total stays < 5µs depends on system load and driver implementation.
TC-PTP-LAT-001b: SET_TIMESTAMP P50 latency < 10µs
Steps:
DeviceIoControl(IOCTL_AVB_SET_TIMESTAMP)with QPCAcceptance Criterion:
P50 < 10µs(REQ-F-PTP-001 §2)TC-PTP-LAT-001c: GET_TIMESTAMP returns non-zero incrementing value
Steps:
phc_t1 > phc_t0Acceptance Criterion: PHC is running (monotonically incrementing)
Acceptance Criteria Summary
IOCTL_AVB_GET_TIMESTAMPP50 latency < 5µs over 1000 callsIOCTL_AVB_SET_TIMESTAMPP50 latency < 10µs over 100 callsImplementation
tests/integration/ptp/ptp_ioctl_latency_test.cptp_ioctl_latency_testTraceability