# HG changeset patch # User Rob Landley # Date 1315661312 18000 # Node ID 4923bba45afe45e26671286b0b2bd4d34ad1b426 # Parent e93e6c80ebdcafee5dc79de085e8eb1dd829885f Try to auto-balance FORK=1 and CPUS so as not to overload build server. diff -r e93e6c80ebdc -r 4923bba45afe more/buildall.sh --- a/more/buildall.sh Sat Sep 10 08:28:00 2011 -0500 +++ b/more/buildall.sh Sat Sep 10 08:28:32 2011 -0500 @@ -28,6 +28,17 @@ cp packages/MANIFEST build || dienow +# Adjust $CPUS so as not to overload the machine, max 2 build processes +# per gigabyte of RAM + +if [ ! -z "$FORK" ] && [ -z "$CPUS" ] +then + MEGS=$(($(awk '/MemTotal:/{print $2}' /proc/meminfo)/1024)) + TARGET_COUNT=$(find sources/targets -maxdepth 1 -type f | wc -l) + export CPUS=$(($MEGS/($TARGET_COUNT*512))) + [ "$CPUS" -lt 1 ] && CPUS=1 +fi + # Build all non-hw targets, possibly in parallel more/for-each-target.sh \