温馨提示×

linux cpustat在哪下载

小樊
34
2026-10-24 03:43:38
栏目: 智能运维

cpustat 并不是 Linux 系统默认自带的标准命令,它通常来自 perf-tools 或 util-linux 中的不同工具,也可能指某些第三方工具。下面按常见情况给你说明下载/安装方式:


1. 如果你说的是 cpustat(来自 perf-tools)

这是 Brendan Gregg 写的一个 CPU 使用统计脚本(基于 perf)。

GitHub 下载

git clone https://github.com/brendangregg/perf-tools.git
cd perf-tools

使用:

sudo ./cpustat 1

需要内核支持 perf 和 ftrace


2. 如果你说的是 cpustat(Go 语言版,by uber)

这是一个用 Go 写的工具: https://github.com/uber-common/cpustat

安装(需 Go 环境)

go install github.com/uber-common/cpustat@latest

或直接下载二进制:

# 示例(x86_64)
wget https://github.com/uber-common/cpustat/releases/latest/download/cpustat-linux-amd64
chmod +x cpustat-linux-amd64
sudo ./cpustat-linux-amd64

3. 如果你只是想看 CPU 状态(不需要 cpustat)

系统自带即可:

top
htop
mpstat -P ALL 1   # 需安装 sysstat
vmstat 1

安装 sysstat:

# Ubuntu / Debian
sudo apt install sysstat

# CentOS / RHEL
sudo yum install sysstat

4. 确认你到底要哪个

你可以先运行:

which cpustat
man cpustat

如果你能告诉我:

  • 你的 Linux 发行版(Ubuntu / CentOS / Arch 等)
  • 是想做 性能分析 还是 看 CPU 占用

我可以给你最准确的一条命令。

0 踩