1、cat /proc/cpuinfo #查看当前计算机的cpu信息 processor : 0 #代表processor(处理器)序号,会从0开始记数,即第一个CPU显示0,第二个 CPU显示1,以此类推下去。 vendor_id : GenuineIntel #代表X86系列CPU制造商标识。例如:“GenuineIntel”(英特尔)或“AuthenticAMD”(AMD)。 cpu family : 6 #CPU厂家生产的CPU系列号, 可用来确定处理器属于那一代产品 model : 85 #CPU属于其系列中的哪一代的代号 model name : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz #CPU属于的名字及其编号、标称主频 stepping : 4 #CPU属于制作更新版本 microcode : 0x1 #CPU微代码 cpu MHz : 2500.018 #CPU的实际使用主频 cache size : 33792 KB #CPU二级缓存大小 physical id : 0 #单个cpu标号 siblings : 1 #单个CPU逻辑物理核数 core id : 0 #当前物理核在其所处CPU中的编号,这个编号不一定连续 cpu cores : 1 #该逻辑核所处CPU的物理核数 apicid : 0 #用来区1、cat /proc/cpuinfo #查看当前计算机的cpu信息 processor : 0 #代表processor(处理器)序号,会从0开始记数,即第一个CPU显示0,第二个 CPU显示1,以此类推下去。 vendor_id : GenuineIntel #代表X86系列CPU制造商标识。例如:“GenuineIntel”(英特尔)或“AuthenticAMD”(AMD)。 cpu family : 6 #CPU厂家生产的CPU系列号, 可用来确定处理器属于那一代产品 model : 85 #CPU属于其系列中的哪一代的代号 model name : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz #CPU属于的名字及其编号、标称主频 stepping : 4 #CPU属于制作更新版本 microcode : 0x1 #CPU微代码 cpu MHz : 2500.018 #CPU的实际使用主频 cache size : 33792 KB #CPU二级缓存大小 physical id : 0 #单个cpu标号 siblings : 1 #单个CPU逻辑物理核数 core id : 0 #当前物理核在其所处CPU中的编号,这个编号不一定连续 cpu cores : 1 #该逻辑核所处CPU的物理核数 apicid : 0 #用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续 initial apicid : 0 # fpu : yes #是否具有浮点运算单元(Floating Point Unit) fpu_exception : yes #是否支持浮点计算异常 cpuid level : 13 #执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容 wp : yes #表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection) ###flags表示:当前CPU支持的功能 ### flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 bogomips : 5000.03 #在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second) clflush size : 64 #每次刷新缓存的大小单位 cache_alignment : 64 #缓存地址对齐单位 address sizes : 46 bits physical, 48 bits virtual #可访问地址空间位数 power management: #对能源管理的支持

================================================== 2、[root@bj-ali01-host ~]# lscpu Architecture: x86_64 #架构 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 #逻辑cpu颗数 On-line CPU(s) list: 0 #在线的cpu列表。0表示第一个cpu,现在是只有一个 Thread(s) per core: 1 #每个核心线程 Core(s) per socket: 1 #每个cpu插槽核数/每颗物理cpu核数 Socket(s): 1 #cpu插槽数 NUMA node(s): 1 #NUMA 节点 Vendor ID: GenuineIntel #cpu厂商ID CPU family: 6 #cpu系列 Model: 85 #CPU属于其系列中的哪一代的代号 Model name: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz #CPU属于的名字及其编号、标称主频 Stepping: 4 #CPU属于制作更新版本 CPU MHz: 2500.018 #cpu主频 BogoMIPS: 5000.03 #在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second) Hypervisor vendor: KVM #当前系统使用的虚拟机类型 Virtualization type: full #支持的虚拟化类型 L1d cache: 32K #表示cpu的L1数据缓存 L1i cache: 32K #表示cpu的L1指令缓存 L2 cache: 1024K #二级缓存 L3 cache: 33792K #三级缓存 NUMA node0 CPU(s): 0 #NUMA cpu节点

================================================== 3、实战: 1)# 查看物理CPU个数 cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

2)# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores	: 1

3)查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
initial apicid	: 0	#
fpu		: yes				#是否具有浮点运算单元(Floating Point Unit)
fpu_exception	: yes			#是否支持浮点计算异常
cpuid level	: 13			#执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容
wp		: yes			#表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
###flags表示:当前CPU支持的功能 ###
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1
bogomips	: 5000.03			#在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size	: 64			#每次刷新缓存的大小单位 
cache_alignment	: 64			#缓存地址对齐单位 
address sizes	: 46 bits physical, 48 bits virtual			#可访问地址空间位数
power management:			#对能源管理的支持

================================================== 2、[root@bj-ali01-host ~]# lscpu Architecture: x86_64 #架构 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 #逻辑cpu颗数 On-line CPU(s) list: 0 #在线的cpu列表。0表示第一个cpu,现在是只有一个 Thread(s) per core: 1 #每个核心线程 Core(s) per socket: 1 #每个cpu插槽核数/每颗物理cpu核数 Socket(s): 1 #cpu插槽数 NUMA node(s): 1 #NUMA 节点 Vendor ID: GenuineIntel #cpu厂商ID CPU family: 6 #cpu系列 Model: 85 #CPU属于其系列中的哪一代的代号 Model name: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz #CPU属于的名字及其编号、标称主频 Stepping: 4 #CPU属于制作更新版本 CPU MHz: 2500.018 #cpu主频 BogoMIPS: 5000.03 #在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second) Hypervisor vendor: KVM #当前系统使用的虚拟机类型 Virtualization type: full #支持的虚拟化类型 L1d cache: 32K #表示cpu的L1数据缓存 L1i cache: 32K #表示cpu的L1指令缓存 L2 cache: 1024K #二级缓存 L3 cache: 33792K #三级缓存 NUMA node0 CPU(s): 0 #NUMA cpu节点

================================================== 3、实战: 1)# 查看物理CPU个数 cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

2)# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores	: 1

3)查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l