在 Debian 系统上,cpustat 通常是指 sysstat 软件包里提供的性能监控工具,或者是 cpustat(Go 编写的工具)。下面分别说明。
很多用户说的 cpustat 实际是 mpstat / sar 等 sysstat 工具集的一部分,但 Debian 官方仓库里并没有单独叫 cpustat 的命令来自 sysstat。
如果你只是想监控 CPU 使用率,推荐直接安装 sysstat:
sudo apt update
sudo apt install sysstat
使用方式:
mpstat 1
sar -u 1 3
如果你指的是这个工具:
https://github.com/pebble/cpustat
sudo apt install golang-go
go install github.com/pebble/cpustat@latest
export PATH=$PATH:$(go env GOPATH)/bin
cpustat
查看最新版本:
https://github.com/pebble/cpustat/releases
示例(以 amd64 为例):
wget https://github.com/pebble/cpustat/releases/download/v1.0.0/cpustat-v1.0.0-linux-amd64.tar.gz
tar -xzf cpustat-v1.0.0-linux-amd64.tar.gz
sudo mv cpustat /usr/local/bin/
cpustat --help
你可以先运行:
which cpustat
man cpustat
如果你能告诉我:
我可以给你更精确的命令。