在 CentOS 上,cpustat 是可以用来监控 CPU 使用情况的,但需要注意几点:
cpustat 是一个 基于 perf 的 CPU 使用率监控工具,来自 sysstat 作者(不是 sysstat 自带的 mpstat)。
它可以按 进程 / 线程 / CPU 显示:
perf(一般默认支持)yum install -y perf gcc make
git clone https://github.com/pepa65/cpustat.git
cd cpustat
make
make install
cpustat 1
cpustat -p 1
cpustat -c 0 1
| 工具 | 特点 |
|---|---|
| top | 基础、实时 |
| htop | 可视化更好 |
| mpstat | 按 CPU 统计 |
| pidstat | 按进程 |
| cpustat | perf 级精度,适合深入分析 |
✅ 能监控
✅ 适合性能排查
⚠️ 不是默认自带工具,需要安装
如果你愿意,可以告诉我:
我可以给你更精确的方案。