3.2. 解释硬件和固件延迟测试结果
这提供有关 hwlatdetect
程序的输出信息。
例子
以下结果代表了经过调优的系统,可最小化固件系统中断。在这种情况下,
hwlatdetect
的输出如下所示:# hwlatdetect --duration=60s hwlatdetect: test duration 60 seconds detector: tracer parameters: Latency threshold: 10us Sample window: 1000000us Sample width: 500000us Non-sampling period: 500000us Output File: None Starting test test finished Max Latency: Below threshold Samples recorded: 0 Samples exceeding threshold: 0
以下结果代表了一个无法调整的系统,以便最大程度降低固件系统中断。在这种情况下,
hwlatdetect
的输出如下所示:# hwlatdetect --duration=10s hwlatdetect: test duration 10 seconds detector: tracer parameters: Latency threshold: 10us Sample window: 1000000us Sample width: 500000us Non-sampling period: 500000us Output File: None Starting test test finished Max Latency: 18us Samples recorded: 10 Samples exceeding threshold: 10 SMIs during run: 0 ts: 1519674281.220664736, inner:17, outer:15 ts: 1519674282.721666674, inner:18, outer:17 ts: 1519674283.722667966, inner:16, outer:17 ts: 1519674284.723669259, inner:17, outer:18 ts: 1519674285.724670551, inner:16, outer:17 ts: 1519674286.725671843, inner:17, outer:17 ts: 1519674287.726673136, inner:17, outer:16 ts: 1519674288.727674428, inner:16, outer:18 ts: 1519674289.728675721, inner:17, outer:17 ts: 1519674290.729677013, inner:18, outer:17----
这个结果显示,在连续读取系统时钟源时,会在 15-18 us 范围内显示 10 延迟。
hwlatdetect
使用 tracer 机制来检测无法解释的延迟。注意之前的版本使用了内核模块而不是
ftrace
tracer。
了解结果
输出显示测试方法、参数和结果。
表 3.1. 测试方法、参数和结果
参数 | 值 | 描述 |
---|---|---|
|
| 测试的时间(以秒为单位) |
|
|
运行 |
| ||
|
| 允许的最大延迟 |
|
| 1 秒 |
|
| 1/2 秒 |
|
| 1/2 秒 |
|
| 输出保存到的文件。 |
| ||
|
|
测试超过 |
|
| 测试记录的样本数。 |
|
|
由测试记录的示例数量,其中延迟超过 |
|
| 测试运行期间发生的系统管理中断数(SMI)。 |
detector 线程运行可执行以下伪代码的循环:
t1 = timestamp() loop: t0 = timestamp() if (t0 - t1) > threshold outer = (t0 - t1) t1 = timestamp if (t1 - t0) > threshold inner = (t1 - t0) if inner or outer: print if t1 > duration: goto out goto loop out:
t0
是每个循环开始时的时间戳。t1
是每个循环末尾的时间戳。内循环比较检查 t0 - t1 不超过指定阈值(10 us default)。outer 循环比较循环底部和 top t1 - t0 之间的时间。最后一次读取时间戳寄存器之间的时间应该是十个纳秒(本质上是寄存器读取、比较和条件跳过),因此固件或系统组件连接方式导致连续读取之间的任何其他延迟。
hwlatdetector
程序为内向和外发程序输出的值是最大延迟的最佳情况。延迟值是连续读取当前系统时钟源(通常是 Time Stamp Counter 或 TSC 注册)之间的增量,但也有可能是 HPET 或 ACPI 电源管理时钟,以及由硬件确认软件组合引入的延迟。
在找到合适的硬件确认组件组合后,下一步是测试系统的实时性能,同时存在负载。