Linux CPU 性能测试与监控工具清单
一 基准测试工具
sysbench cpu --threads=$(nproc) --time=60 run。适合快速评估通用计算能力与扩展性。stress-ng --cpu $(nproc) --timeout 300s --metrics;stress --cpu 4 --timeout 60s。./geekbench5。git clone https://github.com/kdlucas/byte-unixbench.git && cd byte-unixbench/UnixBench && ./Run。./phoronix-test-suite benchmark pts/cpu。7z b。gcc -O -funroll-loops -fomit-frame-pointer pi_fftcs.c fftsg_h.c -lm -o pi_css5 && ./pi_css5 $((1<<26))(计算 2^26 位)。二 监控与分析工具
top/htop(实时进程与 CPU 占用)、mpstat 1 3(每核使用率、I/O 等待)、vmstat 2 5(系统级 CPU/内存/IO 概览)、pidstat -u 1(按进程统计 CPU)、sar(历史与实时 CPU 统计)、uptime(查看1/5/15 分钟平均负载)。perf(CPU 热点函数、调用图、缓存/分支预测等事件)。示例:perf stat -e cache-references,cache-misses ls;perf record -g -p $(pgrep nginx) && perf report。lm-sensors 与 sensors 查看满载温度,判断稳定性与降频风险。三 快速上手与对比建议
mpstat/sensors 观察频率、温度与降频;综合对比:用 Geekbench / Phoronix Test Suite 生成可分享的分数报告;结果可比性:确保相同 CPU 主频/功耗策略(如 performance governor)、相同内核/驱动、测试时长与后台负载一致,并在非生产时段执行。