> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RTC Testbench

## **RTC Testbench**

RTC Testbench 是一套面向 Qualcomm Dragonwing™ 平台上 **OPC/UA over TSN** 的端到端验证工具。它使用两台通过内部 EMAC（`end0`）背靠背直连的 IQ-9075 / QCS9100 设备，在采用 gPTP 时钟同步的 PREEMPT\_RT 内核下，测量 OPC/UA 发布-订阅帧的往返时间（RTT）和单向延迟。

***

### 要点

* **双设备拓扑** — `reference` 和 `mirror` 两种角色，通过 `end0` 使用以太网线直连（无交换机）
* **PREEMPT\_RT + gPTP** — CPU 3–7 进行 RT 隔离；`ptp4l` 和 `phc2sys` 在测试开始前提供亚微秒级时钟同步
* **meta-rtc 层** — 自定义 Yocto 层，与 QLI 2.0 一起构建 OPC/UA 二进制文件、测试脚本和配置
* **成功标准** — 初始预热后 `OpcUaRttOutliers` 或 `OpcUaOnewayOutliers` 不再新增（测试开始时的前 64 个 RTT 异常值是已知的 XDP TX 环预热伪影）

***

### 测试拓扑

```
┌─────────────────────────────┐          ┌─────────────────────────────┐
│   Reference Device          │          │   Mirror Device             │
│   IQ-9075 / QCS9100         │          │   IQ-9075 / QCS9100         │
│                             │          │                             │
│   PREEMPT_RT 6.18           │ end0     │   PREEMPT_RT 6.18           │
│   CPUs 3-7: RT isolated     ├──────────┤   CPUs 3-7: RT isolated     │
│   CPUs 0-2: housekeeping    │ (direct) │   CPUs 0-2: housekeeping    │
│                             │          │                             │
│   ptp4l (CPU 1, FIFO 98)   │◄────────►│   ptp4l (CPU 1, FIFO 98)   │
│   phc2sys (CPU 2, FIFO 98) │  gPTP    │   phc2sys (CPU 2, FIFO 98) │
│   ref binary (CPU pinned)   │  802.1AS │   mirror binary (CPU pinned)│
│   NAPI/IRQ → CPU 6          │          │   NAPI/IRQ → CPU 6          │
└─────────────────────────────┘          └─────────────────────────────┘
```

***

### CPU 划分

| CPU 集合 | 角色 |
| - | - |
| CPU 0–2 | 系统维护（housekeeping）— 中断、内核任务、模拟器线程 |
| CPU 3–7 | RT 隔离 — 应用 `isolcpus`、`nohz_full`、`rcu_nocbs` |
| CPU 6（位于 3–7 范围内） | NAPI 线程 + `end0` 硬件 IRQ 亲和性 |

***

### 子页面

> [card] [构建与设置](https://dragonwingdocs-staging.qualcomm.com/zh/Suites/Industrial-Edge-Suite/rtc-testbench-setup.md)
>
> 使用 meta-rtc 编译、验证 RT 启动、运行 postboot.sh、启动 PTP

> [card] [测试执行](https://dragonwingdocs-staging.qualcomm.com/zh/Suites/Industrial-Edge-Suite/rtc-testbench-execution.md)
>
> 配置对端 MAC、运行 mirror/reference、解读结果

> [card] [参考文件](https://dragonwingdocs-staging.qualcomm.com/zh/Suites/Industrial-Edge-Suite/rtc-testbench-reference.md)
>
> postboot.sh、ptp.sh 和 gPTP\_qcom\_emac.cfg 完整源码

> [card] [RTC 基准测试 IQ9](https://dragonwingdocs-staging.qualcomm.com/zh/Suites/Industrial-Edge-Suite/rtc-benchmarks-iq9.md)
>
> Dragonwing IQ-9075 平台的基准测试结果
