cpustat是Debian服務器監控CPU性能的常用工具,以下是其應用要點:
sudo apt-get install sysstat
安裝sysstat包獲取cpustat。cpustat
。cpustat -t 2 5
(每2秒采樣1次,共5次)。cpustat -c 0,1
。cpustat > cpu_usage.log
。while true; do cpustat >> log.txt; sleep 5; done
。cpustat
命令,或配合腳本批量采集。注:部分功能(如進程級監控)需依賴其他工具(如pidstat),且原cpustat項目已廢棄,建議優先使用sysstat包內工具。