CPU配置信息:
frank@ubuntu:~/test/python$ cat /proc/cpuinfo
processor : #系统中逻辑处理核的编号
vendor_id : GenuineIntel #CPU制造商
cpu family : #CPU产品系列代号
model : #CPU属于其系列中的哪一代的代号
model name : Intel(R) Xeon(R) CPU E5- v4 @ .20GHz #CPU属于的名字及其编号、标称主频
stepping : #CPU属于制作更新版本
microcode : 0xb00001f
cpu MHz : 2199.900 #CPU的实际使用主频
cache size : KB #CPU二级缓存大小
physical id : #单个CPU的标号
siblings : #一个物理CPU中的逻辑核数
core id : #当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores : #一个物理CPU中的物理核数
apicid : #用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap
bogomips : 4399.80
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management:
物理CPU个数: cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
每个CPU物理核数: cat /proc/cpuinfo |grep "cpu cores"|uniq
每个CPU逻辑核数: cat /proc/cpuinfo |grep "siblings"|uniq
总CPU逻辑核数: cat /proc/cpuinfo |grep -c "processor"
我的服务器是两个芯片组,每个芯片组是10核,支持超线程,所以逻辑CPU是40。
超线程指物理内核+逻辑内核,芯片上只存在一个物理内核,但是这个物理内核可以模拟出一个逻辑内核,于是系统信息就显示了两个内核,一真一假。
.查看内存槽数、哪个槽位插了内存,大小是多少
frank@ubuntu:~/test$ sudo dmidecode|grep -P -A5 "Memory Device" |grep Size
Size: GB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: GB
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
Size: No Module Installed
.查看最大支持内存数
frank@ubuntu:~/test$ sudo dmidecode -t memory |grep "Maximum Capacity"
Maximum Capacity: TB
.查看内存速率
frank@ubuntu:~/test$ sudo dmidecode|grep -A16 "Memory Device"|grep 'Speed'
Speed: MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: MHz
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
Speed: Unknown
#!/bin/sh
echo ">>>need root permission<<<\n"
echo "1. equipment brand: `dmidecode -s system-product-name`"
echo "2. OS info: `lsb_release -d | grep "Description"|awk -F: '{print $2}'`"
echo "3. kernel info: `uname -s -m -r`"
echo "4. hardware platform: `uname -i`"
echo "5. cpu info:"
echo "\tbrand and freq: `cat /proc/cpuinfo |grep "model name"|uniq |awk -F: '{print $2}'`"
echo "\tphysical CPUs:`cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l`"
echo "\tphysical cores per CPU: `cat /proc/cpuinfo |grep "cpu cores"|uniq|awk -F: '{print $2}'`"
echo "\tlogical cores per CPU: `cat /proc/cpuinfo |grep "siblings"|uniq|awk -F: '{print $2}'`"
echo "\ttotal logic cores: `cat /proc/cpuinfo |grep -c "processor"`"
echo "6. memory slots and size: \n `dmidecode|grep -P -A5 "Memory Device" |grep Size`"
echo "7. maximum capacity of memory: `dmidecode -t memory |grep "Maximum Capacity"| awk -F: '{print $2}'`"
echo "8. memory speed: \n`dmidecode|grep -A16 "Memory Device"|grep 'Speed'`"