在 Ubuntu(以及其他 Linux 发行版)里,cpustat 通常有两种含义,取决于你指的是哪个“cpustat”:
cpustat 命令(一个性能监控工具)cpustat 是一个用于查看 CPU 使用情况的命令行工具,通常来自 sysstat 工具集或相关包。
sysstat 包里的工具cpustat by Colin Ian King)top 更偏向“CPU 统计”cpustat 1
表示每 1 秒刷新一次 CPU 状态
/proc/stat 里的 cpu 统计(容易混淆)有时候人们说“cpustat”其实是指:
cat /proc/stat
这个文件记录了 Linux 内核统计的 CPU 时间信息。
示例输出:
cpu 1000 200 300 4000 ...
含义:
| 命令 | 作用 |
|---|---|
top / htop |
看进程和 CPU 总体 |
mpstat |
每核 CPU 统计(sysstat) |
cpustat |
CPU 使用率监控 |
vmstat |
系统整体性能 |
可以告诉我你的 Ubuntu 版本(如 20.04 / 22.04),我可以给你准确安装和使用方法。