在 CentOS(及其他 Linux 发行版)中,cpustat 通常是指 sysstat 包中的 mpstat / sar 相关工具,也可能是指 psmisc 或第三方工具 cpustat(如 cpustat by Peter Lawthers 或 Go 写的 cpustat)。不过最常见、系统自带、容易混淆的是:
mpstat(最常被叫做 cpustat)来自 sysstat 包:
yum install sysstat
mpstat 1
能查什么:
示例输出字段:
%usr %nice %sys %iowait %irq %soft %steal %guest %idle
✅ 适合排查:
sar -u(历史 CPU 统计)sar -u 1 3
能查什么:
cpustat 命令(第三方)有些系统中可直接用:
cpustat
常见功能(依赖版本):
top 但更偏 CPU 视角| 命令 | 作用 |
|---|---|
top / htop |
实时进程 CPU 使用 |
vmstat |
CPU + 内存 + IO |
nproc |
CPU 核心数 |
lscpu |
CPU 架构信息 |
cat /proc/stat |
原始 CPU 统计 |
✅ 服务器卡顿
✅ CPU 使用高但不知道谁在用
✅ 多核负载不均衡
✅ 虚拟化环境中 CPU steal 高
✅ 性能压测分析
如果你能告诉我:
mpstat 还是真的 cpustat我可以给你更精准的命令和解读方式。