diff options
author | Darren Hart <dvhart@linux.intel.com> | 2011-07-08 19:02:12 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-12 15:08:21 +0100 |
commit | b8f6c225cd4d869ff05a7ff8b1af04ff7fd735e9 (patch) | |
tree | 646102dcb4078441f5049da977422a0f804b598b /scripts/contrib/bb-perf/bb-matrix.sh | |
parent | 0c17ea177e0607cb6038738b918a416ae4ca50bd (diff) | |
download | poky-b8f6c225cd4d869ff05a7ff8b1af04ff7fd735e9.tar.gz |
bb-matrix: initial scripts to record TIME(1) metrics for BB and PM combinations
The bb-matrix.sh script will run a bitbake command, building core-image-minimal
by default, for various combinations of BB_NUMBER_THREADS and PARALLEL_MAKE. It
records all relevant metrics of the TIME(1) command for each combination in a
data file.
The bb-matrix-plot.sh script can be used to visualize each of these metrics via
a 3d surface plot, either solid surface or wireframe with a value-map
projection on the XY plane.
(From OE-Core rev: 50fdf562ce5c41782ff1bdea43a20e769e61eb92)
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/bb-perf/bb-matrix.sh')
-rwxr-xr-x | scripts/contrib/bb-perf/bb-matrix.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/scripts/contrib/bb-perf/bb-matrix.sh b/scripts/contrib/bb-perf/bb-matrix.sh new file mode 100755 index 0000000000..64d55137c8 --- /dev/null +++ b/scripts/contrib/bb-perf/bb-matrix.sh | |||
@@ -0,0 +1,78 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Copyright (c) 2011, Intel Corporation. | ||
4 | # All rights reserved. | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License as published by | ||
8 | # the Free Software Foundation; either version 2 of the License, or | ||
9 | # (at your option) any later version. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | # GNU General Public License for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License | ||
17 | # along with this program; if not, write to the Free Software | ||
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | # | ||
20 | # DESCRIPTION | ||
21 | # This script runs BB_CMD (typically building core-image-sato) for all | ||
22 | # combincations of BB_RANGE and PM_RANGE values. It saves off all the console | ||
23 | # logs, the buildstats directories, and creates a bb-pm-runtime.dat file which | ||
24 | # can be used to postprocess the results with a plotting tool, spreadsheet, etc. | ||
25 | # Before running this script, it is recommended that you pre-download all the | ||
26 | # necessary sources by performing the BB_CMD once manually. It is also a good | ||
27 | # idea to disable cron to avoid runtime variations caused by things like the | ||
28 | # locate process. Be sure to sanitize the dat file prior to post-processing as | ||
29 | # it may contain error messages or bad runs that should be removed. | ||
30 | # | ||
31 | # AUTHORS | ||
32 | # Darren Hart <dvhart@linux.intel.com> | ||
33 | # | ||
34 | |||
35 | # The following ranges are appropriate for a 4 core system with 8 logical units | ||
36 | BB_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16" | ||
37 | PM_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16" | ||
38 | |||
39 | DATADIR="bb-matrix-$$" | ||
40 | BB_CMD="bitbake core-image-minimal" | ||
41 | RUNTIME_LOG="$DATADIR/bb-matrix.dat" | ||
42 | |||
43 | # See TIME(1) for a description of the time format parameters | ||
44 | # The following all report 0: W K r s t w | ||
45 | TIME_STR="%e %S %U %P %c %w %R %F %M %x" | ||
46 | |||
47 | # Prepare the DATADIR | ||
48 | mkdir $DATADIR | ||
49 | if [ $? -ne 0 ]; then | ||
50 | echo "Failed to create $DATADIR." | ||
51 | exit 1 | ||
52 | fi | ||
53 | |||
54 | # Add a simple header | ||
55 | echo "BB PM $TIME_STR" > $RUNTIME_LOG | ||
56 | for BB in $BB_RANGE; do | ||
57 | for PM in $PM_RANGE; do | ||
58 | RUNDIR="$DATADIR/$BB-$PM-build" | ||
59 | mkdir $RUNDIR | ||
60 | BB_LOG=$RUNDIR/$BB-$PM-bitbake.log | ||
61 | date | ||
62 | echo "BB=$BB PM=$PM Logging to $BB_LOG" | ||
63 | |||
64 | # Export the variables under test and run the bitbake command | ||
65 | export BB_NUMBER_THREADS="${BB##*0}" | ||
66 | export PARALLEL_MAKE="-j ${PM##*0}" | ||
67 | /usr/bin/time -f "$BB $PM $TIME_STR" -a -o $RUNTIME_LOG $BB_CMD &> $BB_LOG | ||
68 | |||
69 | echo " $(tail -n1 $RUNTIME_LOG)" | ||
70 | echo -n " Cleaning up..." | ||
71 | mv tmp/buildstats $RUNDIR/$BB-$PM-buildstats | ||
72 | rm -f pseudodone &> /dev/null | ||
73 | rm -rf tmp &> /dev/null | ||
74 | rm -rf sstate-cache &> /dev/null | ||
75 | rm -rf tmp-eglibc &> /dev/null | ||
76 | echo "done" | ||
77 | done | ||
78 | done | ||