# 總核數 = 物理 CPU 個數 X 每顆物理 CPU 的核數
# 總邏輯 CPU 數 = 物理 CPU 個數 X 每顆物理 CPU 的核數 X 超執行緒數
# 檢視物理 CPU 個數 cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l
# 檢視每個物理 CPU 中 core 的個數 (即核數)cat /proc/cpuinfo| grep “cpu cores”| uniq
# 檢視邏輯 CPU 的個數 cat /proc/cpuinfo| grep “processor”| wc -l
檢視 CPU 的主頻
#cat /proc/cpuinfo |grep MHz|uniq
# uname -a
Linux euis1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
(檢視當前作業系統核心資訊)
# cat /etc/issue | grep Linux
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
(檢視當前作業系統發行版資訊)
# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
8 Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
(看到有 8 個邏輯 CPU, 也知道了 CPU 型號)
# cat /proc/cpuinfo | grep physical | uniq -c
4 physical id : 0
4 physical id : 1
(說明實際上是兩顆 4 核的 CPU)
# getconf LONG_BIT
32
(說明當前 CPU 執行在 32bit 模式下, 但不代表 CPU 不支援 64bit)
# cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l
8
(結果大於 0, 說明支援 64bit 計算. lm 指 long mode, 支援 lm 則是 64bit)
如何獲得 CPU 的詳細資訊:
linux 命令:cat /proc/cpuinfo
用命令判斷幾個物理 CPU,幾個核等:
邏輯 CPU 個數:
# cat /proc/cpuinfo | grep “processor” | wc -l
物理 CPU 個數:
# cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l
每個物理 CPU 中 Core 的個數:
# cat /proc/cpuinfo | grep “cpu cores” | wc -l
是否為超執行緒?
如果有兩個邏輯 CPU 具有相同的”core id”,那麼超執行緒是開啟的。
每個物理 CPU 中邏輯 CPU(可能是 core, threads 或 both) 的個數:
# cat /proc/cpuinfo | grep “siblings”