Friday, July 13, 2012


Find actual Physical CPU count, Cores in a server running Linux

Environment:

> cat /etc/*-release | grep -i linux
SUSE Linux Enterprise Server 10 (x86_64)

The well-known command…

-- In the below example, the /proc/cpuinfo shows processor listing starting from 0 and goes upto 15. So, a total count of 16. So from the below example, how do we figure out the actual count of physical CPU, cores, hyper threading, etc.

> cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 26
model name      : Intel(R) Xeon(R) CPU           X5570  @ 2.93GHz
stepping        : 5
cpu MHz         : 2926.103
cache size      : 8192 KB
physical id     : 1
siblings        : 8
core id         : 0
cpu cores       : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
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 syscall nx rdtscp lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca popcnt lahf_lm
bogomips        : 5857.34
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

.
.
.
.
.
.

processor       : 15
vendor_id       : GenuineIntel
cpu family      : 6
model           : 26
model name      : Intel(R) Xeon(R) CPU           X5570  @ 2.93GHz
stepping        : 5
cpu MHz         : 2926.103
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
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 syscall nx rdtscp lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca popcnt lahf_lm
bogomips        : 5852.07
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:


-- Things to look out for
- processor count – 16 in our case
- siblings – 8 in our case
- cores – 4 in our case
- flags – look for "ht" in flags for hyper threading

-- Calculation

physical cpu = processor count/ siblings
physical cpu = 16/8 = 2 CPU (We have a 2 CPU machine)

cores = number of individual cores in a single cpu
cores = cpu cores = 4

               
                So it is a 2 CPU, 4 core machine with ht enabled.
                2 CPU * 4 Cores * 2(ht enabled) = 16 CPU in /proc/cpuinfo


-- To do a quick check directly from command line

- How many physical processors are there?

> grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l
2

- How many virtual processors are there?

> grep processor /proc/cpuinfo | wc -l
16

No comments:

Post a Comment