温馨提示×

cpustat在debian怎运行

小樊
41
2026-10-07 12:53:04
栏目: 智能运维

在 Debian 上运行 cpustat,通常步骤如下:

1. 安装 cpustat

cpustat 一般在 cpustat 软件包中(来自 stress-ng 作者 Colin King 的工具):

sudo apt update
sudo apt install cpustat

如果提示找不到包,可以先确认:

apt-cache search cpustat

2. 运行 cpustat

cpustat 需要读取 /proc 和 /sys 的 CPU 统计信息,普通用户也能跑,但有些信息可能不全:

cpustat

常见用法示例:

# 每 1 秒刷新一次,共 5 次
cpustat 1 5

# 显示所有 CPU 核心
cpustat -c

# 显示更多信息
cpustat -x

3. 使用 sudo(推荐)

为了获取更完整的调度和进程级 CPU 信息,建议用 root:

sudo cpustat

4. 查看帮助

cpustat --help
man cpustat

如果你是 最小系统 / 容器环境,可能默认没装 cpustat,用上面 apt install 即可。如果你说的是 另一个 cpustat(比如 Go 写的),也可以告诉我,我给你对应运行方式。

0 踩