GetCpuInfo
获取 CPU 详细信息。调用 psutil.cpu_percent(percpu=True, interval=interval) 采样。
- 路由:
POST /system - action:
GetCpuInfo
输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| action | 是 | String | 固定值 GetCpuInfo |
采样间隔固定为 1 秒,不可通过 API 修改。
输出参数
返回数组 [使用率%, 逻辑核心数, [各核使用率...], CPU名称, 物理核心数, 物理CPU数]。
| 索引 | 类型 | 描述 |
|---|---|---|
| 0 | Float | 整体 CPU 使用率(%) |
| 1 | Integer | 逻辑核心数 |
| 2 | Array[Float] | 各核心使用率数组 |
| 3 | String | CPU 型号名称 |
| 4 | Integer | 物理核心数 |
| 5 | Integer | 物理 CPU 数 |
示例
请求
POST /system HTTP/1.1
Content-Type: application/x-www-form-urlencoded
request_time=1700000000&request_token=xxx&action=GetCpuInfo
响应
[12.5, 2, [15.0, 10.0], "Intel Core Processor (Skylake, IBRS)", 1, 1]