1
0

fix: 强化 CPU/memory checker 错误处理、timeout 遵守和快照校验

- Memory checker: reader 与 ctx.signal race,abort 返回 memory/timeout,reject 保持 memory/snapshot
- CPU checker: 第二次快照异常返回 cpu/snapshot,计算前校验空数组/核心数不一致/非有限值/负 delta
- CPU 计算: 零 delta 安全处理,observation 不含 NaN/Infinity
- 文档: CPU 互补描述修正,Memory timeout 约束说明
- 测试: +18 覆盖 timeout、异常和边界输入
This commit is contained in:
2026-05-27 16:33:39 +08:00
parent 145bb8fd04
commit 3390eb5e8d
8 changed files with 394 additions and 24 deletions

View File

@@ -98,7 +98,7 @@ Memory checker 通过 `systeminformation` 库读取系统内存数据,在 Linu
- **Swap 字段**:当系统未配置交换分区时,`swapTotalBytes``0``swapUsagePercent``null`(非 `0`)。
- **`buffcacheBytes`**:反映 Linux 的 buffers + cache 用量,在其他平台上可能为 `null`
Memory checker 是即时读取(非采样),无需 `sampleDuration`,执行速度远快于 CPU checker。
Memory checker 是即时读取(非采样),无需 `sampleDuration`,执行速度远快于 CPU checker。虽然读取本身很快,但仍受 target `timeout` 约束——若底层系统调用悬挂或阻塞超过 `timeout`checker 会返回 `memory/timeout` failure。
## 跨平台注意事项