scripts/contrib/build-perf-test.sh: add a global results file

Append results from each run to a single file in order to keep a history.
Also do some cosmetic changes and fix some whitespace.

(From OE-Core rev: 9b99b4e9284071501859df5631e9019b3000ffe9)

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Stefan Stanacar 2013-03-29 17:10:21 +02:00 committed by Richard Purdie
parent 5769b5971f
commit c6f9e4a675
1 changed files with 27 additions and 16 deletions

View File

@ -108,8 +108,9 @@ fi
if [ -n "$commit" ]; then
echo "git checkout $commit"
git pull > /dev/null 2>&1
git checkout $commit || exit 1
git pull || exit 1
git pull > /dev/null 2>&1
fi
rev=$(git rev-parse --short HEAD) || exit 1
@ -118,6 +119,7 @@ BUILDDIR="$OUTDIR/build"
resultsfile="$OUTDIR/results.log"
bboutput="$OUTDIR/bitbake.log"
myoutput="$OUTDIR/output.log"
globalres="$clonedir/build-perf-test/globalres.log"
mkdir -p $OUTDIR || exit 1
@ -131,9 +133,10 @@ log () {
# Config stuff
#
rev=$(git rev-parse HEAD) || exit 1
log "Git revision is $rev"
source ./oe-init-build-env $OUTDIR/build >/dev/null
source ./oe-init-build-env $OUTDIR/build >/dev/null || exit 1
cd $OUTDIR/build
[ -n "$MACHINE" ] || export MACHINE="qemux86"
@ -155,8 +158,12 @@ fi
# Functions
#
declare -a TIMES
time_count=0
bbtime () {
log "Running and timing bitbake $1"
log "Timing: bitbake $1"
if [ $verbose -eq 0 ]; then
/usr/bin/time -v -o $resultsfile bitbake "$1" >> $bboutput
else
@ -164,13 +171,14 @@ bbtime () {
fi
ret=$?
if [ $ret -eq 0 ]; then
log "Finished bitbake $1"
t=`grep wall $resultsfile | sed 's/.*m:ss): //'`
log "Time: $t"
TIMES[(( time_count++ ))]="$t"
else
log "Exit status was non-zero. Exit..."
exit $ret
fi
log "Time: `grep wall $resultsfile`"
#time by default overwrites the output file and we want to keep the results
#it has an append option but I don't want to clobber the results in the same file
i=`ls $OUTDIR/results.log* |wc -l`
@ -180,7 +188,7 @@ bbtime () {
#we don't time bitbake here
bbnotime () {
log "Running bitbake $1"
log "Running: bitbake $1"
if [ $verbose -eq 0 ]; then
bitbake "$1" >> $bboutput
else
@ -198,7 +206,7 @@ bbnotime () {
do_rmtmp() {
log "Removing tmp"
rm -rf bitbake.lock pseudone tmp conf/sanity_info
rm -rf bitbake.lock pseudodone tmp conf/sanity_info
}
do_rmsstate () {
log "Removing sstate-cache"
@ -244,7 +252,7 @@ do_rmtmp
do_rmsstate
do_sync
bbtime "$IMAGE"
log "Size of tmp dir is: `du -hc tmp | grep total`"
log "Size of tmp dir is: `du -sh tmp | sed 's/tmp//'`"
log "Buildstats are saved in $OUTDIR/buildstats-test1"
mv tmp/buildstats $OUTDIR/buildstats-test1
}
@ -265,8 +273,10 @@ do_rmtmp
do_rmsstate
do_sync
bbtime "$IMAGE"
log "Size of tmp dir is: `du -hc tmp | grep total`"
sed -i 's/INHERIT += \"rm_work\"//' conf/local.conf
log "Size of tmp dir is: `du -sh tmp | sed 's/tmp//'`"
log "Buildstats are saved in $OUTDIR/buildstats-test13"
mv tmp/buildstats $OUTDIR/buildstats-test13
}
@ -291,11 +301,12 @@ test1_p2
test1_p3
test2
log "All done."
log "All done"
# if we got til here write to global results
echo "$rev" >> $globalres
for i in "${TIMES[@]}"; do
echo -n "$i," >> $globalres
done
echo >> $globalres
sed -i '$ s/,$//' $globalres