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-plot.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-plot.sh')
-rwxr-xr-x | scripts/contrib/bb-perf/bb-matrix-plot.sh | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/scripts/contrib/bb-perf/bb-matrix-plot.sh b/scripts/contrib/bb-perf/bb-matrix-plot.sh new file mode 100755 index 0000000000..62aa66d96d --- /dev/null +++ b/scripts/contrib/bb-perf/bb-matrix-plot.sh | |||
@@ -0,0 +1,137 @@ | |||
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 operates on the .dat file generated by bb-matrix.sh. It tolerates | ||
22 | # the header by skipping the first line, but error messages and bad data records | ||
23 | # need to be removed first. It will generate three views of the plot, and leave | ||
24 | # an interactive view open for further analysis. | ||
25 | # | ||
26 | # AUTHORS | ||
27 | # Darren Hart <dvhart@linux.intel.com> | ||
28 | # | ||
29 | |||
30 | # Setup the defaults | ||
31 | DATFILE="bb-matrix.dat" | ||
32 | XLABEL="BB_NUMBER_THREADS" | ||
33 | YLABEL="PARALLEL_MAKE" | ||
34 | FIELD=3 | ||
35 | DEF_TITLE="Elapsed Time (seconds)" | ||
36 | PM3D_FRAGMENT="unset surface; set pm3d at s hidden3d 100" | ||
37 | SIZE="640,480" | ||
38 | |||
39 | function usage { | ||
40 | CMD=$(basename $0) | ||
41 | cat <<EOM | ||
42 | Usage: $CMD [-d datfile] [-f field] [-h] [-t title] [-w] | ||
43 | -d datfile The data file generated by bb-matrix.sh (default: $DATFILE) | ||
44 | -f field The field index to plot as the Z axis from the data file | ||
45 | (default: $FIELD, "$DEF_TITLE") | ||
46 | -h Display this help message | ||
47 | -s W,H PNG and window size in pixels (default: $SIZE) | ||
48 | -t title The title to display, should describe the field (-f) and units | ||
49 | (default: "$DEF_TITLE") | ||
50 | -w Render the plot as wireframe with a 2D colormap projected on the | ||
51 | XY plane rather than as the texture for the surface | ||
52 | EOM | ||
53 | } | ||
54 | |||
55 | # Parse and validate arguments | ||
56 | while getopts "d:f:hs:t:w" OPT; do | ||
57 | case $OPT in | ||
58 | d) | ||
59 | DATFILE="$OPTARG" | ||
60 | ;; | ||
61 | f) | ||
62 | FIELD="$OPTARG" | ||
63 | ;; | ||
64 | h) | ||
65 | usage | ||
66 | exit 0 | ||
67 | ;; | ||
68 | s) | ||
69 | SIZE="$OPTARG" | ||
70 | ;; | ||
71 | t) | ||
72 | TITLE="$OPTARG" | ||
73 | ;; | ||
74 | w) | ||
75 | PM3D_FRAGMENT="set pm3d at b" | ||
76 | W="-w" | ||
77 | ;; | ||
78 | *) | ||
79 | usage | ||
80 | exit 1 | ||
81 | ;; | ||
82 | esac | ||
83 | done | ||
84 | |||
85 | # Ensure the data file exists | ||
86 | if [ ! -f "$DATFILE" ]; then | ||
87 | echo "ERROR: $DATFILE does not exist" | ||
88 | usage | ||
89 | exit 1 | ||
90 | fi | ||
91 | PLOT_BASENAME=${DATFILE%.*}-f$FIELD$W | ||
92 | |||
93 | # Set a sane title | ||
94 | # TODO: parse the header and define titles for each format parameter for TIME(1) | ||
95 | if [ -z "$TITLE" ]; then | ||
96 | if [ ! "$FIELD" == "3" ]; then | ||
97 | TITLE="Field $FIELD" | ||
98 | else | ||
99 | TITLE="$DEF_TITLE" | ||
100 | fi | ||
101 | fi | ||
102 | |||
103 | # Determine the dgrid3d mesh dimensions size | ||
104 | MIN=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 1 | sort | uniq | head -n1) | ||
105 | MAX=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 1 | sort | uniq | tail -n1) | ||
106 | BB_CNT=$[${MAX#*0} - $MIN + 1] | ||
107 | MIN=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 2 | sort | uniq | head -n1) | ||
108 | MAX=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 2 | sort | uniq | tail -n1) | ||
109 | PM_CNT=$[${MAX#*0} - $MIN + 1] | ||
110 | |||
111 | |||
112 | (cat <<EOF | ||
113 | set title "$TITLE" | ||
114 | set xlabel "$XLABEL" | ||
115 | set ylabel "$YLABEL" | ||
116 | set style line 100 lt 5 lw 1.5 | ||
117 | $PM3D_FRAGMENT | ||
118 | set dgrid3d $PM_CNT,$BB_CNT | ||
119 | set ticslevel 0.2 | ||
120 | |||
121 | set term png size $SIZE | ||
122 | set output "$PLOT_BASENAME.png" | ||
123 | splot "$DATFILE" every ::1 using 1:2:$FIELD with lines ls 100 | ||
124 | |||
125 | set view 90,0 | ||
126 | set output "$PLOT_BASENAME-bb.png" | ||
127 | replot | ||
128 | |||
129 | set view 90,90 | ||
130 | set output "$PLOT_BASENAME-pm.png" | ||
131 | replot | ||
132 | |||
133 | set view 60,30 | ||
134 | set term wxt size $SIZE | ||
135 | replot | ||
136 | EOF | ||
137 | ) | gnuplot --persist | ||