在 Debian 上运行 cpustat,通常步骤如下:
cpustat 一般在 cpustat 软件包中(来自 stress-ng 作者 Colin King 的工具):
sudo apt update
sudo apt install cpustat
如果提示找不到包,可以先确认:
apt-cache search cpustat
cpustat 需要读取 /proc 和 /sys 的 CPU 统计信息,普通用户也能跑,但有些信息可能不全:
cpustat
常见用法示例:
# 每 1 秒刷新一次,共 5 次
cpustat 1 5
# 显示所有 CPU 核心
cpustat -c
# 显示更多信息
cpustat -x
为了获取更完整的调度和进程级 CPU 信息,建议用 root:
sudo cpustat
cpustat --help
man cpustat
如果你是 最小系统 / 容器环境,可能默认没装 cpustat,用上面 apt install 即可。如果你说的是 另一个 cpustat(比如 Go 写的),也可以告诉我,我给你对应运行方式。