OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 # Compares a series of compiler reivsions against a target application for | 7 # Compares a series of compiler reivsions against a target application for |
8 # statistic collection. Outputs a gnuplot consumable table. | 8 # statistic collection. Outputs a gnuplot consumable table. |
9 | 9 |
10 APP="" | 10 APP="" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 echo "Head revision = $REV" | 151 echo "Head revision = $REV" |
152 fi | 152 fi |
153 | 153 |
154 function failStats() { | 154 function failStats() { |
155 echo -e "$1\t-1\t0\t-1\t0\t-1\t0" >> $PLOTS | 155 echo -e "$1\t-1\t0\t-1\t0\t-1\t0" >> $PLOTS |
156 return 0; | 156 return 0; |
157 } | 157 } |
158 | 158 |
159 function compileRevision() { | 159 function compileRevision() { |
160 REVISION=$1 | 160 REVISION=$1 |
161 PREBUILT_DIR=$ROOT_OF_REPO/analyzer/revs/$REVISION/prebuilt | 161 PREBUILT_DIR=$ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt |
162 PREBUILT_BIN=$PREBUILT_DIR/analyzer/bin/dart_analyzer | 162 PREBUILT_BIN=$PREBUILT_DIR/compiler/bin/dartc |
163 if [ ! -x $PREBUILT_BIN ]; then | 163 if [ ! -x $PREBUILT_BIN ]; then |
164 echo "No prebuilt, building and caching" | 164 echo "No prebuilt, building and caching" |
165 echo "Checking out clean version of $REVISION; will take some time. Look at
$LOG_FILE for progress" | 165 echo "Checking out clean version of $REVISION; will take some time. Look at
$LOG_FILE for progress" |
166 date | 166 date |
167 cd $TMP_DIR | 167 cd $TMP_DIR |
168 gclient sync -t --revision=$REVISION >> $LOG_FILE 2>&1 | 168 gclient sync -t --revision=$REVISION >> $LOG_FILE 2>&1 |
169 failTest $? "Error calling gclient sync" | 169 failTest $? "Error calling gclient sync" |
170 echo "Run hooks" | 170 echo "Run hooks" |
171 gclient runhooks >> $LOG_FILE 2>&1 | 171 gclient runhooks >> $LOG_FILE 2>&1 |
172 | 172 |
173 echo "Compiling clean version of dart_analyzer; may take some time" | 173 echo "Compiling clean version of dartc; may take some time" |
174 date | 174 date |
175 cd compiler | 175 cd compiler |
176 ../tools/build.py --mode release >> $LOG_FILE 2>&1 | 176 ../tools/build.py --mode release >> $LOG_FILE 2>&1 |
177 if [ ! $? -eq 0 ]; then | 177 if [ ! $? -eq 0 ]; then |
178 echo "error compiling" | 178 echo "error compiling" |
179 failStats $REVISION | 179 failStats $REVISION |
180 return 1; | 180 return 1; |
181 fi | 181 fi |
182 | 182 |
183 # Give the metrics system a backwards compatible way of getting to the | 183 # Give the metrics system a backwards compatible way of getting to the |
184 # artifacts that it needs. | 184 # artifacts that it needs. |
185 cd .. | 185 cd .. |
186 mkdir -p $ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt | 186 mkdir -p $ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt |
187 cd $ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt | 187 cd $ROOT_OF_REPO/compiler/revs/$REVISION/prebuilt |
188 COMPILER_OUTDIR=$TMP_DIR/compiler/out/Release_ia32 | 188 COMPILER_OUTDIR=$TMP_DIR/compiler/out/Release_ia32 |
189 cp -r $COMPILER_OUTDIR/compiler ./compiler | 189 cp -r $COMPILER_OUTDIR/compiler ./compiler |
190 else | 190 else |
191 echo "Cached prebuilt of $REVISION!" | 191 echo "Cached prebuilt of $REVISION!" |
192 fi | 192 fi |
193 | 193 |
194 # Short circuit if we're just filling in the build cache | 194 # Short circuit if we're just filling in the build cache |
195 if [ $RUNS -eq 0 ]; then | 195 if [ $RUNS -eq 0 ]; then |
196 echo "run in compile only mode, no stats generating" | 196 echo "run in compile only mode, no stats generating" |
197 return 0; | 197 return 0; |
198 fi | 198 fi |
199 | 199 |
200 # Do the second test | 200 # Do the second test |
201 echo "Running test with dart_analyzer $REVISION!" | 201 echo "Running test with dartc $REVISION!" |
202 date | 202 date |
203 echo $SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --analyzer=$PRE
BUILT_DIR/analyzer/bin/dart_analyzer $COMPARE_OPTIONS >> $LOG_FILE 2>&1 | 203 echo $SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --dartc=$PREBUI
LT_DIR/compiler/bin/dartc $COMPARE_OPTIONS >> $LOG_FILE 2>&1 |
204 $SCRIPT_PATH/dart_analyzer.sh --stats-prefix=$REVISION --analyzer=$PREBUILT_DI
R/analyzer/bin/dart_analyzer $COMPARE_OPTIONS > $STAT1 | 204 $SCRIPT_PATH/compiler_metrics.sh --stats-prefix=$REVISION --dartc=$PREBUILT_DI
R/compiler/bin/dartc $COMPARE_OPTIONS > $STAT1 |
205 if [ ! $? -eq 0 ]; then | 205 if [ ! $? -eq 0 ]; then |
206 echo "error sampling" | 206 echo "error sampling" |
207 failStats $REVISION | 207 failStats $REVISION |
208 return 2; | 208 return 2; |
209 fi | 209 fi |
210 | 210 |
211 # Output the reivision to the PLOTS file; newline added after stats | 211 # Output the reivision to the PLOTS file; newline added after stats |
212 calcStats $REVISION | 212 calcStats $REVISION |
213 } | 213 } |
214 | 214 |
215 echo -e "#Rev\tFull-ms\tdev\tZeroD\tdev\tOneD\tdev" > $PLOTS | 215 echo -e "#Rev\tFull-ms\tdev\tZeroD\tdev\tOneD\tdev" > $PLOTS |
216 if [ "$LOW_REV" ]; then | 216 if [ "$LOW_REV" ]; then |
217 COUNT=$(( REV - LOW_REV + 1 )) | 217 COUNT=$(( REV - LOW_REV + 1 )) |
218 else | 218 else |
219 LOW_REV=$(( REV - COUNT + 1 )) | 219 LOW_REV=$(( REV - COUNT + 1 )) |
220 fi | 220 fi |
221 for (( i = REV ; i >= LOW_REV ; i-- )) | 221 for (( i = REV ; i >= LOW_REV ; i-- )) |
222 do | 222 do |
223 echo "["$( basename "$APP")": "$((REV - i + 1))"/"$COUNT", rev:$i]" | 223 echo "["$( basename "$APP")": "$((REV - i + 1))"/"$COUNT", rev:$i]" |
224 compileRevision $i | 224 compileRevision $i |
225 done | 225 done |
226 | 226 |
OLD | NEW |