Hey all,

A number of specs use something like:

numprocs=`cat /proc/cpuinfo | grep processor | wc | cut -c7`

But on some systems this is a little problematic... For example, the
output of `cat /proc/cpuinfo` on my machine gives:

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 5
model           : 8
model name      : AMD-K6(tm) 3D processor
stepping        : 12
cpu MHz         : 451.010801
fdiv_bug        : no
hlt_bug         : no
sep_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr mce cx8 sep mtrr pge mmx 3dnow
bogomips        : 901.12

Note that there are two lines containing the word "processor" so the
build will run make -j2. Noticed this recently with the gcc source
package. A better way would be to use:

numprocs=`cat /proc/cpuinfo | grep ^processor | wc | cut -c7`

Which will ensure that "processor" is found at the beginning of the line
only.

John

Reply via email to