Dump build time using Bash $SECONDS internal variable instead of using date calls + Perl-based calculations.
This commit is contained in:
parent
3abe9d7e29
commit
68713c9186
5 changed files with 23 additions and 24 deletions
|
@ -112,6 +112,9 @@
|
|||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select=".//para/userinput | .//screen"/>
|
||||
<xsl:if test="not(@id='ch-chroot-chroot')">
|
||||
<xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>exit</xsl:text>
|
||||
</exsl:document>
|
||||
</xsl:if>
|
||||
|
|
|
@ -111,13 +111,13 @@
|
|||
<xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
||||
</xsl:if>
|
||||
<!-- 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-system-butterfly-toolchain'">
|
||||
<xsl:text>tar -xvf gcc-core-&gcc-version;.*; 
</xsl:text>
|
||||
<xsl:text>tar -xvf binutils-&binutils-version;.*; 
</xsl:text>
|
||||
</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'">
|
||||
<xsl:text>tar -xvf gcc-g++-&gcc-version;.*; 
</xsl:text>
|
||||
</xsl:if>
|
||||
|
@ -128,6 +128,10 @@
|
|||
<!-- END SVN toolchain format -->
|
||||
</xsl:if>
|
||||
<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"
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>exit</xsl:text>
|
||||
</exsl:document>
|
||||
</xsl:if>
|
||||
|
|
|
@ -105,7 +105,11 @@
|
|||
<xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</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"
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>exit
</xsl:text>
|
||||
</exsl:document>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
|
|
@ -53,7 +53,7 @@ BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`"
|
|||
# Match the first timed log to extract the SBU unit value from it
|
||||
BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
|
||||
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 "\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
|
||||
# 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')';`
|
||||
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
|
||||
SBU2=`perl -e 'printf "%.3f" , ('$SBU2' + '$SBU')';`
|
||||
SBU2=`perl -e 'printf "%.1f" , ('$SBU2' + '$SBU')';`
|
||||
|
||||
# Start disk usage calculation
|
||||
# Disk usage before unpacking the package
|
||||
|
|
|
@ -40,8 +40,6 @@ SU_LUSER = su - \$(LUSER) -c
|
|||
LUSER_HOME = \$(LHOME)/\$(LUSER)
|
||||
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"
|
||||
TIME_MARK = \`date +%s.%N\`
|
||||
BUILD_TIME = perl -e "printf \"\nTotalseconds: %.3f\", ('\$\$end' - '\$\$start')"
|
||||
|
||||
ADD_REPORT = $REPORT
|
||||
ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
|
||||
|
@ -234,10 +232,8 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
|
|||
|
||||
(
|
||||
cat << EOF
|
||||
@start=\$(TIME_MARK) && \\
|
||||
export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
|
||||
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
|
||||
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
|
||||
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
|
||||
\$(PRT_DU) >>logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
@ -250,10 +246,8 @@ LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log fil
|
|||
|
||||
(
|
||||
cat << EOF
|
||||
@start=\$(TIME_MARK) && \\
|
||||
source ~/.bashrc && \\
|
||||
@source ~/.bashrc && \\
|
||||
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\
|
||||
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
|
||||
\$(PRT_DU) >>logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
@ -265,10 +259,8 @@ CHROOT_wrt_RunAsRoot() { #
|
|||
local file=$1
|
||||
(
|
||||
cat << EOF
|
||||
@start=\$(TIME_MARK) && \\
|
||||
source envars && \\
|
||||
@source envars && \\
|
||||
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\
|
||||
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
|
||||
\$(PRT_DU_CR) >>logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
@ -285,9 +277,7 @@ LUSER_wrt_CopyFstab() { #
|
|||
#----------------------------------#
|
||||
(
|
||||
cat << EOF
|
||||
@start=\$(TIME_MARK) && \\
|
||||
cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
|
||||
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
|
||||
@cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 && \\
|
||||
\$(PRT_DU) >>logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
@ -298,9 +288,7 @@ CHROOT_wrt_CopyFstab() { #
|
|||
#----------------------------------#
|
||||
(
|
||||
cat << EOF
|
||||
@start=\$(TIME_MARK) && \\
|
||||
cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
|
||||
end=\$(TIME_MARK) && \$(BUILD_TIME) >>logs/\$@ && \\
|
||||
@cp -v /sources/fstab /etc/fstab >>logs/\$@ 2>&1 && \\
|
||||
\$(PRT_DU_CR) >>logs/\$@
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
|
|
Reference in a new issue