2018年11月14日 10:51:27 DebugTheLife 阅读数 1779api
版权声明:©来自CSDN博客做者Debug The Life的原创做品,如需转载,请注明出处。 https://blog.csdn.net/zhaoxixc/article/details/84062639bash
Physical id #相同表示为同一个物理CPU Processor #逻辑CPU Cpu cores #CPU核数,内核个数 Core id #内核id号 Siblings #每一个物理CPU里面的逻辑CPU个数
[root@testhost ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 4 Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz [root@testhost ~]#
[root@testhost ~]# cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l 2
[root@testhost ~]# cat /proc/cpuinfo | grep "processor" | wc -l 4
[root@testhost ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq cpu cores : 2
[root@testhost ~]# cat /proc/cpuinfo | grep "siblings" | uniq siblings : 2
逻辑CPU > 物理CPU x CPU核数 #开启超线程
逻辑CPU = 物理CPU x CPU核数 #没有开启超线程或不支持超线程ui
[root@testhost ~]# cat /proc/cpuinfo | grep -e "cpu cores" -e "siblings" | sort | uniq cpu cores : 2 siblings : 2
说明:若是cpu cores数量和siblings数量一致,则没有启用超线程,不然超线程被启用。spa
[root@testhost ~]# cat cpu.sh #!/bin/bash cpuname=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c) physical=$(cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l) processor=$(cat /proc/cpuinfo | grep "processor" | wc -l) cpucores=$(cat /proc/cpuinfo | grep "cpu cores" | uniq) siblings=$(cat /proc/cpuinfo | grep "siblings" | uniq) echo "* * * * * CPU Information * * * * *" echo "(CPU型号)cpu name : $cpuname" echo "(物理CPU个数)physical id is : $physical" echo "(逻辑CPU个数)processor is : $processor" echo "(CPU内核数)cpu cores is : $cpucores" echo "(单个物理CPU的逻辑CPU数)siblings is : $siblings" [root@testhost ~]#
[root@testhost ~]# sh cpu.sh * * * * * CPU Information * * * * * (CPU型号)cpu name : 4 Intel(R) Core(TM) i7 CPU M 620 @ 2.67GHz (物理CPU个数)physical id is : 2 (逻辑CPU个数)processor is : 4 (CPU内核数)cpu cores is : cpu cores : 2 (单个物理CPU的逻辑CPU数)siblings is : siblings : 2 [root@testhost ~]#
[root@testhost ~]# uname -a Linux testhost 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
说明:i386 i686为32位;x86_64为64位.net
[root@testhost ~]# cat /proc/cpuinfo | grep lm 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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat 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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat 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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat 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 rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat
说明:lm: “Long Mode,” which means the chip supports the AMD64 instruction set线程