Mercurial > hg > aboriginal
diff sources/include.sh @ 900:266dc7ea04c2
If there's enough memory (half a gig per processor), use 1.5x as many CPUs to try to keep 'em busy.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 24 Nov 2009 03:19:07 -0600 |
parents | 850da666acc6 |
children | f1671488c740 |
line wrap: on
line diff
--- a/sources/include.sh Mon Nov 23 21:58:49 2009 -0600 +++ b/sources/include.sh Tue Nov 24 03:19:07 2009 -0600 @@ -29,10 +29,15 @@ # How many processors should make -j use? +MEMTOTAL="$(awk '/MemTotal:/{print $2}' /proc/meminfo)" if [ -z "$CPUS" ] then export CPUS=$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w) [ "$CPUS" -lt 1 ] && CPUS=1 + + # If there's enough memory, try to make CPUs stay busy. + + [ $(($CPUS*512*1024)) -le $MEMTOTAL ] && CPUS=$((($CPUS*3)/2)) fi [ -z "$STAGE_NAME" ] && STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'`