Re: # of Physical processors in a Unix system




yOn Mon, 28 Aug 2006 17:01:44 +0000 (UTC), Winfried Magerl
<winfried.magerl@xxxxxxxxxx> wrote:
In article <1156772126.001932.59340@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
pbaronia <prashant.baronia@xxxxxxxxx> wrote:
Hi all, How do we find the number of physiscal processors in a linux
system. To be very specific I am NOT talking about the logical
processors.

For example dual-xeon with HT enabled:

# egrep '(^processor|^physical id)' /proc/cpuinfo
processor : 0
physical id : 6
processor : 1
physical id : 0
processor : 2
physical id : 0
processor : 3
physical id : 6

you see four processor's but only two physical id's.

awk -F: '/physical id/{if(++ids[$2]==1)cpus++}
END{if(cpus)print cpus; else print 1}' /proc/cpuinfo

--
One Bell System - it sometimes works.
.