[blfs-dev] Package stats

Fernando de Oliveira famobr at yahoo.com.br
Thu Mar 6 09:36:02 PST 2014


Em 06-03-2014 13:36, Bruce Dubbs escreveu:
> There is a question in the tickets about statistics.  This is how I do 
> it.  I have a script for each package that measures time and size.
> 
> I build packages in /tmp, but really could be anywhere.
> 
> First measure the free disk space:
> 
> before=`df -k /tmp | grep / | sed -e "s/ \{2,\}/ /g" | cut -d' ' -f3`
> 
> Run the build:
> 
> TIMEFMT='%1R Elapsed Time - '
> 
> { time \
>    {
>      echo Making $TITLE
>      date
>      # Instructions go here
> 
> 
>    }
> } 2>&1 | tee -a $LOG
> 
> Get the statistics:
> 
> stats $LOG $DIR/$PROGRAM.tar.?z* $before
> 
> Where stats does:
> 
> function stats()
> {
>    log=$1
>    tarball=$2
>    b4=$3
> 
>    #  This changes slightly for a base LFS build
>    base_sbu=118
> 
>    free_now=`df -k /tmp | grep / | sed -e "s/ \{2,\}/ /g" |
>      cut -d" " -f3`
> 
>    buildtime=`tail -n1 $log|cut -f1 -d" "`
>    sbu=`echo "scale=3; $buildtime / $base_sbu" | 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-$(lsb_release -r|
>      cut -f2).log
> }
> 
>    So build size is measured as df_after - df_before.  The issue to note 
> is that there is activity during the build that adds or deletes space on 
> /tmp, the size will be off.  I have /tmp on its own partition.
> 
>    -- Bruce
> 


Thanks, Bruce.

I find "du" more accurate, although more tome consuming, so have to to
mark some instants to avoid it from interfering in the timings.

On example is that df wil include the log size, perhaps you think it is
relevant.

But all numbers we give are approximate, large error bar, so I do not
dispute methods or numbers.

The problem there is that Ken found values very different, even one
negative: building the API docs takes less than installing the ones in
the tarball, is one example, and I can hardly believe this is possible:
build taking less time than just installing the documents.

As I introduced many of these numbers, probably after what Ken used to
do with ImageMagick, what I think is that being non-english speaking
native, I am giving wrong names to what I measure. That was the reason I
detailed how and what I measure there. It seems I need to rename in the
book, some number I gave.

What I mean is: everybody know 1 inch is different from 1 cm. But I can
use a ruler, make a measurement and tell Ken it is 1, using a cm ruler,
but he thinking I am using inches.

He is not wrong

I am not wrong

We are giving numbers for different things, probably my fault of not
writing carefully what my number means.

-- 
[]s,
Fernando



More information about the blfs-dev mailing list