cpustat 是一个用于监控系统 CPU 性能的工具,它是 sysstat 包的一部分。要使用 cpustat 监控系统性能,请按照以下步骤操作:
sysstat 包。在 Debian 系统上,可以使用以下命令安装:sudo apt-get update
sudo apt-get install sysstat
cpustat 命令来查看 CPU 性能。默认情况下,cpustat 会显示系统的 CPU 使用情况,包括用户空间、系统空间、空闲时间等。运行以下命令:cpustat
-i 选项指定间隔(以秒为单位)。例如,要每 5 秒监控一次 CPU 性能,请运行:cpustat -i 5
-c 选项后跟核心编号。例如,要监控核心 0 的性能,请运行:cpustat -c 0
-e 选项显示每个 CPU 核心的详细统计信息。例如:cpustat -e
>)。例如,要将输出保存到名为 cpu_usage.txt 的文件中,请运行:cpustat > cpu_usage.txt
这些选项可以组合使用,以便根据需要监控特定的 CPU 核心和时间间隔。更多关于 cpustat 的信息和选项,请参阅其手册页(通过运行 man cpustat 查看)。