Wednesday, April 24, 2013

Determining CPU/core counts on Linux Server

Here are the commands that can be used to determine the physical CPU/core and logical CPU counts on a Linux server.

1. Determining the number of logical processors seen by the OS:

cat /proc/cpuinfo | grep ^processor | wc -l

2. Determining  the number of physical CPUs on a machine:

cat /proc/cpuinfo | grep "physical id" | uniq | wc -l

3. Determining the number of cores per CPU:

cat /proc/cpuinfo | grep "cores" | head -1

4. Determining if Hyperthreading is turned on:

a.  First determine the number of siblings per CPU.  Siblings are the number of logical processors sharing the same physical processor:

cat /proc/cpuinfo | grep "siblings" | head -1

b. If the number of CPU cores per processor  (from #2 above) is the same as the number of siblings, then Hyperthreading is off.  If siblings is 2 times the number of cores, Hyperthreading is turned on.

No comments:

Post a Comment