linux cpu信息记录在/proc/cpuinfo中
CPU总核数 = 物理CPU个数 * 每颗物理CPU的核数;
总逻辑CPU数 = 物理CPU个数 * 每颗物理CPU的核数 * 超线程数;
#查看CPU信息(型号)
[bigdata@localhost ~]$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
8 Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz
# 查看物理CPU个数
[bigdata@localhost ~]$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
8
# 查看每个物理CPU中core的个数(即核数)
[bigdata@localhost ~]$ cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores : 1
# 查看逻辑CPU的个数
[bigdata@localhost ~]$ cat /proc/cpuinfo | grep "processor" | wc -l
8