2012년 4월 19일 목요일

LINUX CPU 코어 확인

processor      : 7 
vendor_id      : GenuineIntel 
cpu family      : 6 
model          : 15 
model name      : Intel(R) Xeon(R) CPU          X7350  @ 2.93GHz 
stepping        : 11 
cpu MHz        : 2931.976 
cache size      : 4096 KB 
physical id    : 4 
siblings        : 4 
core id        : 3 
cpu cores      : 4 
fdiv_bug        : no 
hlt_bug        : no 
f00f_bug        : no 
coma_bug        : no 
fpu            : yes 
fpu_exception  : yes 
cpuid level    : 10 
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm 
bogomips        : 5863.12 

종합해 보면 아래와 같다. 
physical id    : 3 siblings        : 4 core id        : 0 cpu cores      : 4 
physical id    : 4 siblings        : 4 core id        : 0 cpu cores      : 4 
physical id    : 3 siblings        : 4 core id        : 1 cpu cores      : 4 
physical id    : 4 siblings        : 4 core id        : 1 cpu cores      : 4 
physical id    : 3 siblings        : 4 core id        : 2 cpu cores      : 4 
physical id    : 4 siblings        : 4 core id        : 2 cpu cores      : 4 
physical id    : 3 siblings        : 4 core id        : 3 cpu cores      : 4 
physical id    : 4 siblings        : 4 core id        : 3 cpu cores      : 4 


siblings는 해당 physical cpu당 몇개의 논리 cpu(core)가 존재하는지의 갯수를 의미한다. 

여기선 processor 가 7 이므로 0~7로 8개의 프로세스가 되는 것이고 
sibling이 4이고, cpu cores가 4인걸로 봐선 quard core이다. 
따라서 8/4=2 
Physical 2 EA * 4Core 를 의미 한다. 

Physical id 도 3,4  두개만 보이는걸로 봐도 물리적 cpu가 2개이다.


---------------------------------------------------------------------------
스크립트로 확인하기


리눅스에서 CPU 확인 하는 스크립트 
CHIP_COUNT=`cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l`; CHIP_CORES=`cat /proc/cpuinfo | grep "siblings" | tail -1 | cut -d: -f2`; echo "CPU: $CHIP_COUNT chips x $CHIP_CORES cores"