Dump build time using Bash $SECONDS internal variable instead of using date calls + Perl-based calculations.

This commit is contained in:
Manuel Canales Esparcia 2007-08-17 16:24:47 +00:00
parent 3abe9d7e29
commit 68713c9186
5 changed files with 23 additions and 24 deletions

View file

@ -112,6 +112,9 @@
</xsl:if> </xsl:if>
</xsl:if> </xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/> <xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-chroot-chroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text> <xsl:text>exit</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>

View file

@ -111,13 +111,13 @@
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text> <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
</xsl:if> </xsl:if>
<!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc --> <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
<xsl:if test="@id='ch-tools-embryo-toolchain' or <xsl:if test="@id='ch-tools-embryo-toolchain' or
@id='ch-tools-cocoon-toolchain' or @id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'"> @id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
<xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
</xsl:if> </xsl:if>
<xsl:if test="@id='ch-tools-cocoon-toolchain' or <xsl:if test="@id='ch-tools-cocoon-toolchain' or
@id='ch-system-butterfly-toolchain'"> @id='ch-system-butterfly-toolchain'">
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text> <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
</xsl:if> </xsl:if>
@ -128,6 +128,10 @@
<!-- END SVN toolchain format --> <!-- END SVN toolchain format -->
</xsl:if> </xsl:if>
<xsl:apply-templates select=".//para/userinput | .//screen"/> <xsl:apply-templates select=".//para/userinput | .//screen"/>
<xsl:if test="not(@id='ch-system-chroot') and
not(@id='ch-system-revisedchroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit</xsl:text> <xsl:text>exit</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>

View file

@ -105,7 +105,11 @@
<xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/> <xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/>
<xsl:text>&#xA;</xsl:text> <xsl:text>&#xA;</xsl:text>
</xsl:if> </xsl:if>
<xsl:text>exit</xsl:text> <xsl:if test="not(@id='ch-system-chroot') and
not(@id='ch-system-revisedchroot')">
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
</xsl:if>
<xsl:text>exit&#xA;</xsl:text>
</exsl:document> </exsl:document>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>

View file

@ -53,7 +53,7 @@ BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`"
# Match the first timed log to extract the SBU unit value from it # Match the first timed log to extract the SBU unit value from it
BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1` BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value." echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*.[[:digit:]]*\)$/\1/p' $BASELOG` SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n"
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT" echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds.\n" >> "$REPORT"
@ -70,13 +70,13 @@ for log in $BUILDLOGS ; do
# Start SBU calculation # Start SBU calculation
# Build time # Build time
TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*.[[:digit:]]*\)$/\1/p' $log` TIME=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $log`
SECS=`perl -e 'print ('$TIME' % '60')';` SECS=`perl -e 'print ('$TIME' % '60')';`
MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';` MINUTES=`perl -e 'printf "%.0f" , (('$TIME' - '$SECS') / '60')';`
SBU=`perl -e 'printf "%.3f" , ('$TIME' / '$SBU_UNIT')';` SBU=`perl -e 'printf "%.1f" , ('$TIME' / '$SBU_UNIT')';`
# Append SBU value to SBU2 for grand total # Append SBU value to SBU2 for grand total
SBU2=`perl -e 'printf "%.3f" , ('$SBU2' + '$SBU')';` SBU2=`perl -e 'printf "%.1f" , ('$SBU2' + '$SBU')';`
# Start disk usage calculation # Start disk usage calculation
# Disk usage before unpacking the package # Disk usage before unpacking the package

View file

@ -40,8 +40,6 @@ SU_LUSER = su - \$(LUSER) -c
LUSER_HOME = \$(LHOME)/\$(LUSER) LUSER_HOME = \$(LHOME)/\$(LUSER)
PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n" PRT_DU = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found \$(MOUNT_PT) \`\n"
PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n" PRT_DU_CR = echo -e "\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) --exclude=lost+found / \`\n"
TIME_MARK = \`date +%s.%N\`
BUILD_TIME = perl -e "printf \"\nTotalseconds: %.3f\", ('\$\$end' - '\$\$start')"
ADD_REPORT = $REPORT ADD_REPORT = $REPORT
ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
@ -234,10 +232,8 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
( (
cat << EOF cat << EOF
@start=\$(TIME_MARK) && \\ @export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
\$(PRT_DU) >>logs/\$@ \$(PRT_DU) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -250,10 +246,8 @@ LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log fil
( (
cat << EOF cat << EOF
@start=\$(TIME_MARK) && \\ @source ~/.bashrc && \\
source ~/.bashrc && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\ \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
\$(PRT_DU) >>logs/\$@ \$(PRT_DU) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -265,10 +259,8 @@ CHROOT_wrt_RunAsRoot() { #
local file=$1 local file=$1
( (
cat << EOF cat << EOF
@start=\$(TIME_MARK) && \\ @source envars && \\
source envars && \\
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
\$(PRT_DU_CR) >>logs/\$@ \$(PRT_DU_CR) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -285,9 +277,7 @@ LUSER_wrt_CopyFstab() { #
#----------------------------------# #----------------------------------#
( (
cat << EOF cat << EOF
@start=\$(TIME_MARK) && \\ @cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
\$(PRT_DU) >>logs/\$@ \$(PRT_DU) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
@ -298,9 +288,7 @@ CHROOT_wrt_CopyFstab() { #
#----------------------------------# #----------------------------------#
( (
cat << EOF cat << EOF
@start=\$(TIME_MARK) && \\ @cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
\$(PRT_DU_CR) >>logs/\$@ \$(PRT_DU_CR) >>logs/\$@
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp