# HG changeset patch # User Rob Landley # Date 1259054347 21600 # Node ID 266dc7ea04c292576913c68bb77ba5fee9ba15fd # Parent 726cac165450d159cdc9329ebf4055d29c142d09 If there's enough memory (half a gig per processor), use 1.5x as many CPUs to try to keep 'em busy. diff -r 726cac165450 -r 266dc7ea04c2 sources/include.sh --- 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@'`