在 Debian 下,cpustat 通常是 sysstat 工具包里的一个工具,用来查看 CPU 使用率统计,比 top 更偏向“采样/统计”用途。下面按常见使用场景说明。
cpustat --version
sudo apt update
sudo apt install sysstat
安装完成后,cpustat 一般位于:
/usr/bin/cpustat
cpustat
输出示例:
CPU user nice system idle iowait irq softirq steal guest guest_nice
all 5.2 0.0 2.1 92.3 0.2 0.0 0.1 0.0 0.0 0.0
字段说明:
user:用户态 CPUsystem:内核态 CPUidle:空闲iowait:等待 IOirq / softirq:中断steal:虚拟机被 hypervisor 抢占cpustat 1 5
含义:
cpustat -c all
或单独查看某个 CPU:
cpustat -c 0
cpustat -p
cpustat -t
输出示例:
2026-01-15 10:30:01 all 5.1 ...
cpustat -o cpu.csv
或结合采样:
cpustat -o cpu.csv 1 10
cpustat 1
cpustat 1 10
idle 很低 → CPU 很忙iowait 很高 → 磁盘 IO 问题steal 很高 → 云主机资源被抢占| 工具 | 用途 |
|---|---|
top |
实时进程级 CPU 监控 |
mpstat |
每个 CPU 核心统计 |
cpustat |
简洁的 CPU 使用率采样 |
如果你更关心 进程,用 top / htop
如果你更关心 CPU 整体趋势,用 cpustat / mpstat
确认:
dpkg -L sysstat | grep cpustat
如果确实没有,可以用:
mpstat
功能类似,Debian 一定包含。
如果你愿意,我也可以帮你:
cpustat 输出是否异常top / mpstat / sar 哪个更适合你的场景