Variability in build times.

Bruce Dubbs bruce.dubbs at gmail.com
Mon Oct 18 14:46:51 PDT 2010


Ken Moffat wrote:
> On Mon, Oct 18, 2010 at 10:19:58PM +0100, Ken Moffat wrote:
>>  I've never imagined that build times were exactly repeatable, but
>> I'd assumed that, *on an unloaded system with only a browser
>> running* the times would be fairly close, say plus or minus 3%.
>> Now, I start to wonder.
>>
>  I forgot to add that the original builds were probably into swap
> (abiword is almost at the end of my build, and if I look, I usually
> see the box is using swap during a build), but no swap was used
> after the most recent [slow] build.
> 
>  Also, I'm deleting the source directory between builds.

I haven't looked at it in detail, but I think files in memory are kept 
around for a while until it's needed for something else.  About the only 
way to really get repeatability is to reboot between tries and that 
isn't realistic.

In any case, I use a script like the following one for each program.
Installing the package on /tmp allows for repeatability in size, if not 
SBU time.

   -- Bruce

#!/bin/bash

source /usr/src/stats

#######################
# Installing openssh

DIR=`pwd`
PROGRAM=openssh-4.5p1
LOG=$DIR/$PROGRAM.log
TITLE=$PROGRAM
TIMEFORMAT="$TIMEFMT $TITLE"

BUILDDIR=/tmp/openssh
DEST=$BUILDDIR/install
rm -rf $BUILDDIR
mkdir $BUILDDIR
cd $BUILDDIR

before=`df -k / | grep / | sed -e "s/ \{2,\}/ /g" | cut -d' ' -f3`


tar -xf $DIR/$PROGRAM.tar.?z* || exit 1

cd $PROGRAM
{ time \
   {
     echo Making $TITLE
     date

     sed -i "s:-lcrypto:/usr/lib/libcrypto.a:g" configure
     ./configure --prefix=/usr \
                 --sysconfdir=/etc/ssh \
                 --libexecdir=/usr/lib/openssh \
                 --with-md5-passwords \
                 --with-privsep-path=/var/lib/sshd &&
     make &&
     make DESTDIR=$DEST install &&
     install -v -m755 -d $DEST/usr/share/doc/$PROGRAM &&
     install -v -m644 INSTALL LICENCE OVERVIEW README* WARNING.RNG \
         $DEST/usr/share/doc/$PROGRAM

   }
} 2>&1 | tee -a $LOG

if [ $PIPESTATUS -ne 0 ]; then exit 1; fi;

stats $LOG $DIR/$PROGRAM.tar.?z* $before

exit 0
-----------------------
$ cat stats

#!/bin/bash

function stats()
{
   log=$1
   tarball=$2
   b4=$3

   free_now=`df -k / | grep / | sed -e "s/ \{2,\}/ /g" | cut -d" " -f3`

   buildtime=`tail -n1 $log|cut -f1 -d" "`
   sbu=`echo "scale=3; $buildtime / 132.5" | bc`

   psizeK=`du -k $tarball | cut -f1`
   psizeM=`echo "scale=3; $psizeK / 1024"   | bc`

   bsizeK=`echo "$free_now - $b4"           | bc`
   bsizeM=`echo "scale=3; $bsizeK / 1024"   | bc`

   echo "SBU=$sbu"                                  | tee -a $log
   echo "$psizeK $tarball size ($psizeM MB)"        | tee -a $log
   echo "$bsizeK kilobytes build size ($bsizeM MB)" | tee -a $log
   (echo -n "md5sum : "; md5sum $tarball)           | tee -a $log
   (echo -n "sha1sum: "; sha1sum $tarball)          | tee -a $log

   echo "`date` $tarball" >> /usr/src/packages.log
}

TIMEFMT='%1R Elapsed Time - '
------------------



More information about the blfs-dev mailing list