cpustat 是一个用于监控 CPU 使用情况的工具,它是 sysstat 包的一部分。cpustat 提供了丰富的参数来定制输出的信息和格式。以下是一些常用的 cpustat 参数及其详解:
-c 或 –cpu:
-c 0 显示第一个 CPU 的信息。-m 或 –mixed:
cpustat 只显示 CPU 使用率。-P 或 –pid:
-u 或 –user:
-s 或 –system:
-i 或 –idle:
-w 或 –wait:
-h 或 –help:
-e 或 –elapsed:
cpustat 以来的时间。-r 或 –relative:
-t 或 –timestamps:
-C 或 –class:
-N 或 –nice:
-V 或 –version:
cpustat 的版本信息。显示所有 CPU 的详细统计信息:
cpustat -c 显示第一个 CPU 的详细统计信息:
cpustat -c 0 显示用户态 CPU 使用率:
cpustat -u 显示内核态 CPU 使用率:
cpustat -s 显示空闲 CPU 时间:
cpustat -i 显示等待 I/O 的 CPU 时间:
cpustat -w 显示自系统启动以来的总时间:
cpustat -e 显示相对于上次调用的 CPU 使用率变化:
cpustat -r 在输出中添加时间戳:
cpustat -t 按 CPU 类别显示统计信息:
cpustat -C 显示调整过优先级的进程的 CPU 使用情况:
cpustat -N 通过组合这些参数,你可以灵活地定制 cpustat 的输出,以满足你的监控需求。