Logging and bc. [Was: Re: r3353]

Ag. D. Hatzimanikas a.hatzim at gmail.com
Sun May 20 05:00:17 PDT 2007


On Σαβ, Μάι 19, at 02:03 M.Canales.es wrote:
> 
> I don't know Perl sintax, thus I opted by bc when creating the script. I you 
> can create a patch dropping bc dependency while kepping the same 
> functionality, we will apply it.
> 

Ok, first have a look at he format and if you like it, I will continue
to port the test script to Jhalfs.
Have a look.

========================================================================================
				[binutils-pass1]

Build time is:						2 minutes and 44 seconds
Build time in seconds is:				164
Approximate SBU time is:				1.000
Disk usage before unpacking the package:		202689 KB or 197.938 MB
Disk usage before deleting the source and build dirs:	422942 KB or 413.029 MB
Required space to build the package:			220253 KB or 215.091 MB
Installed files disk usage:				45256 KB or 44.196 MB

========================================================================================
				[gcc-pass1]

Build time is:						26 minutes and 19 seconds
Build time in seconds is:				1579
Approximate SBU time is:				9.628
Disk usage before unpacking the package:		247945 KB or 242.134 MB
Disk usage before deleting the source and build dirs:	922735 KB or 901.108 MB
Required space to build the package:			674790 KB or 658.974 MB
Installed files disk usage:				26230 KB or 25.615 MB

========================================================================================
				[linux-headers]

Build time is:						0 minutes and 16 seconds
Build time in seconds is:				16
Approximate SBU time is:				0.098
Disk usage before unpacking the package:		274175 KB or 267.749 MB
Disk usage before deleting the source and build dirs:	561976 KB or 548.805 MB
Required space to build the package:			287801 KB or 281.056 MB
Installed files disk usage:				2421 KB or 2.364 MB

========================================================================================
				[glibc]

Build time is:						17 minutes and 15 seconds
Build time in seconds is:				1035
Approximate SBU time is:				6.311
Disk usage before unpacking the package:		276596 KB or 270.113 MB
Disk usage before deleting the source and build dirs:	631271 KB or 616.476 MB
Required space to build the package:			354675 KB or 346.363 MB
Installed files disk usage:				64369 KB or 62.861 MB

========================================================================================

Etc....

Attached is the test script I used to do the work.
Please run it within the log directory and compare the results for a moment with
Jhalfs's, to see if they are accurate. Like so:
./test `pwd`
-------------- next part --------------
#!/bin/bash

REPORT=LOG
[ -f $REPORT ] && : >$REPORT
LOGSDIR=$1
BUILDLOGS="`grep -l "^real\>" ${LOGSDIR}/*`"
LINE="========================================================================================"
BASELOG=`grep -l "^real\>" $LOGSDIR/* | head -n1`
echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
BASEMINUTES=`sed -n 's/^real[ \t]*\([[:digit:]]*\)m.*$/\1/p' $BASELOG`
BASESECONDS=`sed -n 's/^real[ \t].*m\([[:digit:]]*\)\..*$/\1/p' $BASELOG`
SBU_UNIT=`perl -e 'print ('$BASEMINUTES' * '60' + '$BASESECONDS',"\n")';`
echo -e "The SBU unit value is equal to $SBU_UNIT seconds.\n"
SBU2=0
INSTALL2=0
INSTALLMB2=0

for log in $BUILDLOGS; do
  PACKAGE="${log#*[[:digit:]]*-}"
  BUILDTIME=`sed -n 's/^real[ \t]*\([[:digit:]]*\)m\([[:digit:]]*\)\..*$/\1 minutes and \2 seconds/p' $log`
  MINUTES=`sed -n 's/^real[ \t]*\([[:digit:]]*\)m.*$/\1/p' $log`
  SECS=`sed -n 's/^real[ \t].*m\([[:digit:]]*\)\..*$/\1/p' $log`
  TIME=`perl -e 'print ('$MINUTES' * '60' + '$SECS')';`
  SBU=`perl -e 'printf "%.3f\n" , ('$TIME' / '$SBU_UNIT')';`
  SBU2=`perl -e 'printf "%.3f\n" , ('$SBU2' + '$SBU')';`
  DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'`
  DU1MB=`perl -e 'printf "%.3f\n" , ('$DU1' / '1024')';`
  DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'`
  DU2MB=`perl -e 'printf "%.3f\n" , ('$DU2' / '1024')';`
  REQUIRED1=`perl -e 'print ('$DU2' - '$DU1', "\n")';`
  REQUIRED2=`perl -e 'printf "%.3f\n" , ('$DU2MB' - '$DU1MB')';`
  if [ "$log" != "$BASELOG" ] ; then
    INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV', "\n")';`
    INSTALLMB=`perl -e 'printf "%.3f\n" , ('$DU1MB' - '$DU1MBPREV')';`
    echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
    INSTALL2=`perl -e 'printf "%.3f\n" , ('$INSTALL2' + '$INSTALL')';`
    INSTALLMB2=`perl -e 'printf "%.3f\n" , ('$INSTALLMB2' + '$INSTALLMB')';`
  fi
  DU1PREV=$DU1
  DU1MBPREV=$DU1MB
  echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> $REPORT
  echo -e "Build time is:\t\t\t\t\t\t$BUILDTIME" >> $REPORT
  echo -e "Build time in seconds is:\t\t\t\t$TIME" >> $REPORT
  echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> $REPORT
  echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> $REPORT
  echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> $REPORT
  echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB" >> $REPORT
done
echo -e "\n$LINE\n\nTotal time required to build the systen:\t\t$SBU2  SBU" >> $REPORT
echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> $REPORT


More information about the alfs-discuss mailing list