diff options
author | Stefan Stanacar <stefanx.stanacar@intel.com> | 2013-03-29 17:10:21 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-29 16:23:11 +0000 |
commit | c6f9e4a67591ffc1e0cc28f9e2480f62a8d156be (patch) | |
tree | 61af09675fbccd1ffab0a379f8bb765f0fa44ac6 | |
parent | 5769b5971fdf58c0cf97ffb6fc7268b7fb802601 (diff) | |
download | poky-c6f9e4a67591ffc1e0cc28f9e2480f62a8d156be.tar.gz |
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>
-rwxr-xr-x | scripts/contrib/build-perf-test.sh | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/scripts/contrib/build-perf-test.sh b/scripts/contrib/build-perf-test.sh index 2d70cfae52..0f7a3a9ae5 100755 --- a/scripts/contrib/build-perf-test.sh +++ b/scripts/contrib/build-perf-test.sh | |||
@@ -108,8 +108,9 @@ fi | |||
108 | 108 | ||
109 | if [ -n "$commit" ]; then | 109 | if [ -n "$commit" ]; then |
110 | echo "git checkout $commit" | 110 | echo "git checkout $commit" |
111 | git pull > /dev/null 2>&1 | ||
111 | git checkout $commit || exit 1 | 112 | git checkout $commit || exit 1 |
112 | git pull || exit 1 | 113 | git pull > /dev/null 2>&1 |
113 | fi | 114 | fi |
114 | 115 | ||
115 | rev=$(git rev-parse --short HEAD) || exit 1 | 116 | rev=$(git rev-parse --short HEAD) || exit 1 |
@@ -118,6 +119,7 @@ BUILDDIR="$OUTDIR/build" | |||
118 | resultsfile="$OUTDIR/results.log" | 119 | resultsfile="$OUTDIR/results.log" |
119 | bboutput="$OUTDIR/bitbake.log" | 120 | bboutput="$OUTDIR/bitbake.log" |
120 | myoutput="$OUTDIR/output.log" | 121 | myoutput="$OUTDIR/output.log" |
122 | globalres="$clonedir/build-perf-test/globalres.log" | ||
121 | 123 | ||
122 | mkdir -p $OUTDIR || exit 1 | 124 | mkdir -p $OUTDIR || exit 1 |
123 | 125 | ||
@@ -131,9 +133,10 @@ log () { | |||
131 | # Config stuff | 133 | # Config stuff |
132 | # | 134 | # |
133 | 135 | ||
136 | rev=$(git rev-parse HEAD) || exit 1 | ||
134 | log "Git revision is $rev" | 137 | log "Git revision is $rev" |
135 | 138 | ||
136 | source ./oe-init-build-env $OUTDIR/build >/dev/null | 139 | source ./oe-init-build-env $OUTDIR/build >/dev/null || exit 1 |
137 | cd $OUTDIR/build | 140 | cd $OUTDIR/build |
138 | 141 | ||
139 | [ -n "$MACHINE" ] || export MACHINE="qemux86" | 142 | [ -n "$MACHINE" ] || export MACHINE="qemux86" |
@@ -155,8 +158,12 @@ fi | |||
155 | # Functions | 158 | # Functions |
156 | # | 159 | # |
157 | 160 | ||
161 | declare -a TIMES | ||
162 | time_count=0 | ||
163 | |||
158 | bbtime () { | 164 | bbtime () { |
159 | log "Running and timing bitbake $1" | 165 | log "Timing: bitbake $1" |
166 | |||
160 | if [ $verbose -eq 0 ]; then | 167 | if [ $verbose -eq 0 ]; then |
161 | /usr/bin/time -v -o $resultsfile bitbake "$1" >> $bboutput | 168 | /usr/bin/time -v -o $resultsfile bitbake "$1" >> $bboutput |
162 | else | 169 | else |
@@ -164,13 +171,14 @@ bbtime () { | |||
164 | fi | 171 | fi |
165 | ret=$? | 172 | ret=$? |
166 | if [ $ret -eq 0 ]; then | 173 | if [ $ret -eq 0 ]; then |
167 | log "Finished bitbake $1" | 174 | t=`grep wall $resultsfile | sed 's/.*m:ss): //'` |
175 | log "Time: $t" | ||
176 | TIMES[(( time_count++ ))]="$t" | ||
168 | else | 177 | else |
169 | log "Exit status was non-zero. Exit..." | 178 | log "Exit status was non-zero. Exit..." |
170 | exit $ret | 179 | exit $ret |
171 | fi | 180 | fi |
172 | 181 | ||
173 | log "Time: `grep wall $resultsfile`" | ||
174 | #time by default overwrites the output file and we want to keep the results | 182 | #time by default overwrites the output file and we want to keep the results |
175 | #it has an append option but I don't want to clobber the results in the same file | 183 | #it has an append option but I don't want to clobber the results in the same file |
176 | i=`ls $OUTDIR/results.log* |wc -l` | 184 | i=`ls $OUTDIR/results.log* |wc -l` |
@@ -180,7 +188,7 @@ bbtime () { | |||
180 | 188 | ||
181 | #we don't time bitbake here | 189 | #we don't time bitbake here |
182 | bbnotime () { | 190 | bbnotime () { |
183 | log "Running bitbake $1" | 191 | log "Running: bitbake $1" |
184 | if [ $verbose -eq 0 ]; then | 192 | if [ $verbose -eq 0 ]; then |
185 | bitbake "$1" >> $bboutput | 193 | bitbake "$1" >> $bboutput |
186 | else | 194 | else |
@@ -198,7 +206,7 @@ bbnotime () { | |||
198 | 206 | ||
199 | do_rmtmp() { | 207 | do_rmtmp() { |
200 | log "Removing tmp" | 208 | log "Removing tmp" |
201 | rm -rf bitbake.lock pseudone tmp conf/sanity_info | 209 | rm -rf bitbake.lock pseudodone tmp conf/sanity_info |
202 | } | 210 | } |
203 | do_rmsstate () { | 211 | do_rmsstate () { |
204 | log "Removing sstate-cache" | 212 | log "Removing sstate-cache" |
@@ -244,7 +252,7 @@ do_rmtmp | |||
244 | do_rmsstate | 252 | do_rmsstate |
245 | do_sync | 253 | do_sync |
246 | bbtime "$IMAGE" | 254 | bbtime "$IMAGE" |
247 | log "Size of tmp dir is: `du -hc tmp | grep total`" | 255 | log "Size of tmp dir is: `du -sh tmp | sed 's/tmp//'`" |
248 | log "Buildstats are saved in $OUTDIR/buildstats-test1" | 256 | log "Buildstats are saved in $OUTDIR/buildstats-test1" |
249 | mv tmp/buildstats $OUTDIR/buildstats-test1 | 257 | mv tmp/buildstats $OUTDIR/buildstats-test1 |
250 | } | 258 | } |
@@ -265,8 +273,10 @@ do_rmtmp | |||
265 | do_rmsstate | 273 | do_rmsstate |
266 | do_sync | 274 | do_sync |
267 | bbtime "$IMAGE" | 275 | bbtime "$IMAGE" |
268 | log "Size of tmp dir is: `du -hc tmp | grep total`" | ||
269 | sed -i 's/INHERIT += \"rm_work\"//' conf/local.conf | 276 | sed -i 's/INHERIT += \"rm_work\"//' conf/local.conf |
277 | log "Size of tmp dir is: `du -sh tmp | sed 's/tmp//'`" | ||
278 | log "Buildstats are saved in $OUTDIR/buildstats-test13" | ||
279 | mv tmp/buildstats $OUTDIR/buildstats-test13 | ||
270 | } | 280 | } |
271 | 281 | ||
272 | 282 | ||
@@ -291,11 +301,12 @@ test1_p2 | |||
291 | test1_p3 | 301 | test1_p3 |
292 | test2 | 302 | test2 |
293 | 303 | ||
294 | log "All done." | 304 | log "All done" |
295 | |||
296 | |||
297 | |||
298 | |||
299 | |||
300 | |||
301 | 305 | ||
306 | # if we got til here write to global results | ||
307 | echo "$rev" >> $globalres | ||
308 | for i in "${TIMES[@]}"; do | ||
309 | echo -n "$i," >> $globalres | ||
310 | done | ||
311 | echo >> $globalres | ||
312 | sed -i '$ s/,$//' $globalres | ||