forked from gormanm/mmtests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard-kernels-static.sh
executable file
·263 lines (239 loc) · 5.74 KB
/
dashboard-kernels-static.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#!/bin/bash
export SCRIPT=`basename $0 | sed -e 's/\./\\\./'`
export SCRIPTDIR=`echo $0 | sed -e "s/$SCRIPT//"`
. $SCRIPTDIR/shellpacks/common.sh
. $SCRIPTDIR/shellpacks/common-config.sh
. $SCRIPTDIR/config
KERNEL_BASE=
KERNEL_COMPARE=
KERNEL_EXCLUDE=
while [ "$1" != "" ]; do
case $1 in
--format)
FORMAT=$2
FORMAT_CMD="--format $FORMAT"
shift 2
;;
--output-dir)
OUTPUT_DIRECTORY=$2
shift 2
;;
--baseline)
KERNEL_BASE=$2
shift 2
;;
--compare)
KERNEL_COMPARE="$2"
shift 2
;;
--webroot)
REPORTROOT="$2"
shift 2
;;
--result-dir)
cd "$2" || die Result directory does not exist or is not directory
shift 2
;;
--sort-version)
SORT_VERSION=yes
shift
;;
--top)
shift 2
;;
--topout)
shift 2
;;
--table-id)
shift 2
;;
--toplatest)
shift
;;
*)
echo Unrecognised argument: $1 1>&2
shift
;;
esac
done
FORMAT_CMD=
if [ "$FORMAT" != "" ]; then
FORMAT_CMD="--format $FORMAT"
fi
if [ "$OUTPUT_DIRECTORY" != "" -a ! -e "$OUTPUT_DIRECTORY" ]; then
mkdir -p $OUTPUT_DIRECTORY
fi
if [ "$OUTPUT_DIRECTORY" != "" -a ! -d "$OUTPUT_DIRECTORY" ]; then
echo Output directory is not a directory
exit -1
fi
if [ `ls "$FIRST_ITERATION_PREFIX"tests-timestamp-* 2> /dev/null | wc -l` -eq 0 ]; then
die This does not look like a mmtests results directory
fi
if [ -n "$KERNEL_BASE" ]; then
for KERNEL in $KERNEL_COMPARE $KERNEL_BASE; do
if [ ! -e "$FIRST_ITERATION_PREFIX"tests-timestamp-$KERNEL ]; then
die "Cannot find results for kernel '$KERNEL'."
fi
done
else
if [ -n "$KERNEL_COMPARE" ]; then
die "Specifying --compare without --baseline is invalid!"
fi
fi
# Build a list of kernels
if [ "$KERNEL_BASE" != "" ]; then
KERNEL_LIST=$KERNEL_BASE
for KERNEL in $KERNEL_COMPARE; do
KERNEL_LIST=$KERNEL_LIST,$KERNEL
done
else
[ -n "$ITERATIONS" ] && pushd $FIRST_ITERATION_PREFIX > /dev/null
for KERNEL in `grep -H ^start tests-timestamp-* | awk -F : '{print $4" "$1}' | sort -n | awk '{print $2}' | sed -e 's/tests-timestamp-//'`; do
EXCLUDE=no
for TEST_KERNEL in $KERNEL_EXCLUDE; do
if [ "$TEST_KERNEL" = "$KERNEL" ]; then
EXCLUDE=yes
fi
done
if [ "$EXCLUDE" = "no" ]; then
if [ "$KERNEL_BASE" = "" ]; then
KERNEL_BASE=$KERNEL
KERNEL_LIST=$KERNEL
else
KERNEL_LIST="$KERNEL_LIST,$KERNEL"
fi
fi
done
[ -n "$ITERATIONS" ] && popd > /dev/null
fi
if [ "$SORT_VERSION" = "yes" ]; then
LIST_SORT=$KERNEL_LIST
KERNEL_LIST=
KERNEL_BASE=
for KERNEL in `echo $LIST_SORT | sed -e 's/,/\n/g' | sort -t . -k2 -n`; do
if [ "$KERNEL_BASE" = "" ]; then
KERNEL_BASE=$KERNEL
KERNEL_LIST=$KERNEL
else
KERNEL_LIST="$KERNEL_LIST,$KERNEL"
fi
done
fi
KERNEL_LIST_ITER=`echo $KERNEL_LIST | sed -e 's/,/ /g'`
declare -a GOOD_STRINGS
declare -a GOOD_COLOURS
declare -a BAD_STRINGS
declare -a BAD_COLOURS
GOOD_STRINGS[0]="Satisfactory"
GOOD_STRINGS[1]="Good"
GOOD_STRINGS[2]="Great"
GOOD_STRINGS[3]="Excellent"
BAD_STRINGS[0]="Unsatisfactory"
BAD_STRINGS[1]="Bad"
BAD_STRINGS[2]="Awful"
BAD_STRINGS[3]="Abominable"
GOOD_COLOURS[3]="#007800"
GOOD_COLOURS[2]="#009F00"
GOOD_COLOURS[1]="#00C700"
GOOD_COLOURS[0]="#00EE00"
BAD_COLOURS[3]="#780000"
BAD_COLOURS[2]="#9F0000"
BAD_COLOURS[1]="#C70000"
BAD_COLOURS[0]="#EE0000"
UNKNOWN_COLOUR="#FFFFFF"
NEUTRAL_COLOUR="#A0A0A0"
if [ "$FORMAT" = "html" ]; then
echo "<table cellspacing=0>"
fi
AOPEN=
ACLOSE=
if [ "$REPORTROOT" != "" ]; then
AOPEN="<a href=\"$REPORTROOT\" title="$KERNEL_LIST">"
ACLOSE="</a>"
fi
for SUBREPORT in `grep "test begin :: " "$FIRST_ITERATION_PREFIX"tests-timestamp-$KERNEL_BASE | awk '{print $4}'`; do
COMPARE_CMD="compare-mmtests.pl --print-ratio -d . -b $SUBREPORT -n $KERNEL_LIST"
case $SUBREPORT in
*)
GMEAN=`$COMPARE_CMD | grep ^Gmean | sed -e 's/([0-9.% -]*)//g'`
GOODNESS=Unknown
COLOUR=$UNKNOWN_COLOUR
RATIO=0
DESCRIPTION=Unknown
OUTPUT=
if [ "$GMEAN" != "" ]; then
GOODNESS=`echo $GMEAN | awk '{print $2}'`
NR_FIELDS=`echo $GMEAN | awk '{print NF}'`
if [ $NR_FIELDS -gt 3 ]; then
FIELD_LIST=`seq 4 $NR_FIELDS`
else
FIELD_LIST=3
fi
for FIELD in $FIELD_LIST; do
RATIO=`echo $GMEAN | awk "{print \\$$FIELD}"`
if [ "$RATIO" != "nan" ]; then
RATIO_ADJUSTED=`perl -e "print (($RATIO*10000))"`
DELTA=$((RATIO_ADJUSTED-10000))
if [ $DELTA -lt 0 ]; then
DELTA=$((-DELTA))
fi
if [ $DELTA -lt 100 ]; then
DESCRIPTION="Neutral"
COLOUR=$NEUTRAL_COLOUR
else
INDEX=
if [ $DELTA -lt 200 ]; then
INDEX=0
elif [ $DELTA -le 500 ]; then
INDEX=1
elif [ $DELTA -le 1000 ]; then
INDEX=2
else
INDEX=3
fi
if [ "$GOODNESS" = "Higher" ]; then
if [ $RATIO_ADJUSTED -gt 10000 ]; then
DESCRIPTION=${GOOD_STRINGS[$INDEX]}
COLOUR=${GOOD_COLOURS[$INDEX]}
else
DESCRIPTION=${BAD_STRINGS[$INDEX]}
COLOUR=${BAD_COLOURS[$INDEX]}
fi
else
if [ $RATIO_ADJUSTED -lt 10000 ]; then
DESCRIPTION=${GOOD_STRINGS[$INDEX]}
COLOUR=${GOOD_COLOURS[$INDEX]}
else
DESCRIPTION=${BAD_STRINGS[$INDEX]}
COLOUR=${BAD_COLOURS[$INDEX]}
fi
fi
fi
fi
if [ "$FORMAT" != "html" ]; then
OUTPUT+=`printf "%8.4f %-15s " $RATIO $DESCRIPTION`
else
OUTPUT+="<td bgcolor=\"$COLOUR\"><font size=1>$AOPEN$RATIO$ACLOSE</font></td>"
fi
done
else
if [ "$FORMAT" != "html" ]; then
OUTPUT+=`printf "%8.4f %-15s " 0 Unknown`
else
OUTPUT+="<td bgcolor=\"$COLOUR\"><font size=1>$AOPEN$RATIO$ACLOSE</font></td>"
fi
fi
if [ "$FORMAT" != "html" ]; then
printf "%-20s %-8s %s\n" $SUBREPORT $GOODNESS "$OUTPUT"
else
echo "<tr>"
echo "<td bgcolor=\"$COLOUR\"><font size=1>$SUBREPORT</font></td>"
echo $OUTPUT
echo "</tr>"
fi
esac
done
if [ "$FORMAT" = "html" ]; then
echo "</table>"
fi