Changeset 0210014 for common/create-sbu_du-report.sh
- Timestamp:
- 05/26/2007 09:16:18 PM (17 years ago)
- Branches:
- 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
- Children:
- c6f33fb
- Parents:
- 81fca31
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/create-sbu_du-report.sh
r81fca31 r0210014 6 6 LOGSDIR=$1 7 7 VERSION=$2 8 9 LINE="================================================================================" 8 10 9 11 # Make sure that we have a directory as first argument … … 26 28 REPORT="$VERSION"-SBU_DU-$(date --iso-8601).report 27 29 30 [ -f $REPORT ] && : >$REPORT 31 28 32 # Dump generation time stamp and book version 29 33 echo -e "\n`date`\n" > "$REPORT" … … 45 49 46 50 # Parse only that logs that have time data 47 BUILDLOGS= `grep -l "^real\>" $LOGSDIR/*`51 BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`" 48 52 49 53 # Match the first timed log to extract the SBU unit value from it 50 BASELOG=`grep -l "^real\>" $LOGSDIR/* | head -n1` 51 echo -e "\n\nUsing $BASELOG to obtain the SBU unit value." >> "$REPORT" 52 BASEMINUTES=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/m.*//'` 53 BASESECONDS=`grep "^real\>" $BASELOG | cut -f2 | sed -e 's/.*m//;s/s//'` 54 SBU_UNIT=`echo "scale=3; $BASEMINUTES * 60 + $BASESECONDS" | bc` 55 echo -e "The SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" 54 BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1` 55 echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value." 56 SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*.[[:digit:]]*\)$/\1/p' $BASELOG` 57 echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" 58 echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" 56 59 57 60 # Set the first value to 0 for grand totals calculation … … 60 63 INSTALLMB2=0 61 64 65 # Start the loop 62 66 for log in $BUILDLOGS ; do 63 67 64 #Start SBU calculation 65 # Build time 66 BUILDTIME=`grep "^real\>" $log | cut -f2` 67 # Build time in seconds 68 MINUTES=`grep "^real\>" $log | cut -f2 | sed -e 's/m.*//'` 69 SECS=`grep "^real\>" $log | cut -f2 | sed -e 's/.*m//;s/s//'` 70 TIME=`echo "scale=3; $MINUTES * 60 + $SECS" | bc` 71 # Calculate build time in SBU 72 SBU=`echo "scale=3; $TIME / $SBU_UNIT" | bc` 73 # Append SBU value to SBU2 for grand total 74 SBU2="$SBU2 + $SBU" 68 # Strip the filename 69 PACKAGE="${log#*[[:digit:]]*-}" 75 70 76 #Start disk usage calculation 77 # Disk usage before unpacking the package 71 # Start SBU calculation 72 # Build time 73 TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*.[[:digit:]]*\)$/\1/p' $log` 74 SECS=`perl -e 'print ('$TIME' % '60')';` 75 MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';` 76 SBU=`perl -e 'printf "%.3f" , ('$TIME' / '$SBU_UNIT')';` 77 78 # Append SBU value to SBU2 for grand total 79 SBU2=`perl -e 'printf "%.3f" , ('$SBU2' + '$SBU')';` 80 81 # Start disk usage calculation 82 # Disk usage before unpacking the package 78 83 DU1=`grep "^KB: " $log | head -n1 | cut -f1 | sed -e 's/KB: //'` 79 DU1MB=` echo "scale=2; $DU1 / 1024" | bc`80 84 DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';` 85 # Disk usage before deleting the source and build dirs 81 86 DU2=`grep "^KB: " $log | tail -n1 | cut -f1 | sed -e 's/KB: //'` 82 DU2MB=` echo "scale=2; $DU2 / 1024" | bc`83 84 REQUIRED1=` echo "$DU2 - $DU1" | bc`85 REQUIRED2=` echo "scale=2; $DU2MB - $DU1MB" | bc`87 DU2MB=`perl -e 'printf "%.3f" , ('$DU2' / '1024')';` 88 # Calculate disk space required to do the build 89 REQUIRED1=`perl -e 'print ('$DU2' - '$DU1')';` 90 REQUIRED2=`perl -e 'printf "%.3f" , ('$DU2MB' - '$DU1MB')';` 86 91 87 88 92 # Append installed files disk usage to the previous entry, 93 # except for the first parsed log 89 94 if [ "$log" != "$BASELOG" ] ; then 90 INSTALL=` echo "$DU1 - $DU1PREV" | bc`91 INSTALLMB=` echo "scale=2; $DU1MB - $DU1MBPREV" | bc`92 echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> "$REPORT"95 INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';` 96 INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';` 97 echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT 93 98 # Append install values for grand total 94 INSTALL2= "$INSTALL2 + $INSTALL"95 INSTALLMB2= "$INSTALLMB2 + $INSTALLMB"99 INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';` 100 INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';` 96 101 fi 97 102 98 103 # Set variables to calculate installed files disk usage 99 104 DU1PREV=$DU1 100 105 DU1MBPREV=$DU1MB 101 106 102 # Append log name 103 echo -e "\n\t$log" >> "$REPORT" 104 105 # Dump time values 106 echo -e "Build time is:\t\t\t$BUILDTIME" >> "$REPORT" 107 echo -e "Build time in seconds is\t$TIME" >> "$REPORT" 108 echo -e "Approximate SBU time is:\t$SBU" >> "$REPORT" 109 110 # Dump disk usage values 111 echo -e "\nDisk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> "$REPORT" 112 echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT" 113 echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB\n" >> "$REPORT" 107 # Dump time and disk usage values 108 echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> $REPORT 109 echo -e "Build time is:\t\t\t\t\t\t$MINUTES minutes and $SECS seconds" >> $REPORT 110 echo -e "Build time in seconds is:\t\t\t\t$TIME" >> $REPORT 111 echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> $REPORT 112 echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> $REPORT 113 echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> $REPORT 114 echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB" >> $REPORT 114 115 115 116 done 116 117 117 118 # Dump grand totals 118 TOTALSBU=`echo "scale=3; ${SBU2}" | bc` 119 echo -e "\nTotal time required to build the systen:\t$TOTALSBU SBU\n" >> "$REPORT" 120 TOTALINSTALL=`echo "${INSTALL2}" | bc` 121 TOTALINSTALLMB=`echo "scale=2; ${INSTALLMB2}" | bc` 122 echo -e "Total Installed files disk usage 123 (including /tools but not /sources):\t$TOTALINSTALL KB or $TOTALINSTALLMB MB\n" >> "$REPORT" 124 125 119 echo -e "\n$LINE\n\nTotal time required to build the systen:\t\t$SBU2 SBU" >> $REPORT 120 # Total disk usage: including /tools but not /sources. 121 echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> $REPORT
Note:
See TracChangeset
for help on using the changeset viewer.