CPU情報(型番、物理数、論理数、コア数)の調べ方
サーバのCPU情報を確認する必要があり、確認方法を調べたので備忘録として残しておきます。
/proc/cpuinfoの参照
型番の確認
$ grep 'model name' /proc/cpuinfo | uniq model name : Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
今回の環境では、CPUはXeon E5-2630L v2を利用していることがわかります。
OSが認識しているCPU数(論理数)
# grep processor /proc/cpuinfo processor : 0 processor : 1 processor : 2 processor : 3 processor : 4 processor : 5 processor : 6 processor : 7 processor : 8 processor : 9 processor : 10 processor : 11
0から11までの合計12個が認識されていることがわかります。
# grep 'siblings' /proc/cpuinfo | uniq siblings : 12
シブリングの項目でも、認識数が確認できます。
実際に搭載されている物理数
$ grep 'physical id' /proc/cpuinfo | uniq physical id : 0
論理数が12個なのに対して、物理数は1つです。
コア数
$ grep 'cpu cores' /proc/cpuinfo | uniq cpu cores : 6
1 CPUに6つのコアがあることが確認できます。しかしこれでは1 [cpu] x 6 [core/cpu] = 6なので、OSで認識されているCPUの数の12と合致しません。 今回のCPUではHyper-threadingが有効となっていて、1つのコアを2つのCPUとして認識しているためです。 コア数がシブリングと同一の値であれば、Hyper-threadingは無効で動作しています。
lscpu
型番以外の情報はlscpuでも確認できます。
$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 12 On-line CPU(s) list: 0-11 Thread(s) per core: 2 Core(s) per socket: 6 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 62 Stepping: 4 CPU MHz: 1871.906 BogoMIPS: 4799.89 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 15360K NUMA node0 CPU(s): 0-11
CPU(s)で論理数、Thread(s) per coreでHyper-threading時の1コアあたりの認識数、Core(s) per socketで1CPUあたりのコア数、Socket(s)でCPUの物理数を表しています。