我如何最好地总结 bogomips?

han*_*ast 1 linux shell central-processing-unit

我想比较运行 Linux (Centos) 的服务器 - 明智的 CPU。

我想把所有 cpus bogomips 的总和进行比较,但只能想出这个丑陋的外壳线:

echo 0 `cat /proc/cpuinfo | grep bogomips | cut -d ":" -f 2 | tr " " "+" `| bc
Run Code Online (Sandbox Code Playgroud)

(需要 0,否则该行以 + 开头,不适合 bc)

有没有更好的方法来做到这一点?

Den*_*son 5

awk -F: '/bogomips/ {sum+=$2} END {print sum}' /proc/cpuinfo
Run Code Online (Sandbox Code Playgroud)