OLD | NEW |
(Empty) | |
| 1 #!/bin/bash --posix |
| 2 # |
| 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 |
| 5 # BSD-style license that can be found in the LICENSE file. |
| 6 |
| 7 # Compiles either TotalDart or Thump based on benchmark and reports |
| 8 # the metrics back to the collector. |
| 9 # Removes 'out' directory if one exists. |
| 10 |
| 11 # Determine where the libs are |
| 12 DARTC_HOME=`readlink -f .` |
| 13 DIST_DIR=$DARTC_HOME/compiler |
| 14 DARTC_BIN=$DIST_DIR/bin/dartc |
| 15 |
| 16 # A word about directories |
| 17 # The project directories are now copied before this script runs and we just hav
e to change |
| 18 # in to the correct sub-directory to compile. We'll send the output of compiles
and metrics |
| 19 # to the script directory instead of poluting the cache. |
| 20 LAST_ARG=`readlink -f ${!#}` |
| 21 BENCH_DIR=`dirname $LAST_ARG` |
| 22 |
| 23 # Big hack. We assume that the benchmark argument in the list: |
| 24 # x/y/dart/BenchmarkName.dart |
| 25 BENCH_NAME=`basename $LAST_ARG .dart` |
| 26 |
| 27 # Currently we only benchmark the compilation of two applications; |
| 28 # Redpill's Thump and Dart's Total. |
| 29 if [ $BENCH_NAME == "Total" ]; then |
| 30 cd $BENCH_DIR/samples/total/src/ |
| 31 APP_FILE=Total.dart |
| 32 DART_MAIN_FILE=Total.dart |
| 33 else |
| 34 if [ $BENCH_NAME == "Thump" ]; then |
| 35 cd $BENCH_DIR/samples/swarm |
| 36 APP_FILE=swarm.dart |
| 37 DART_MAIN_FILE=SwarmApp.dart |
| 38 else |
| 39 echo "ERROR: Compilation failed - benchmark ${BENCH_NAME} != Total | Thump"
1>&2 |
| 40 exit 1 |
| 41 fi |
| 42 fi |
| 43 |
| 44 DARTC_FLAGS="--metrics --out $DARTC_HOME/out " |
| 45 |
| 46 # Warmup period, run the compiler a few times to warm up the os/filesystem/etc |
| 47 # before collecting metrics |
| 48 $DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > /dev/null 2>&1 |
| 49 rm -Rf $DARTC_HOME/out |
| 50 |
| 51 # Full compile metrics |
| 52 $DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > $DARTC_HOME/build.full.txt |
| 53 |
| 54 # Single file delta incremental metrics |
| 55 touch $DART_MAIN_FILE |
| 56 $DARTC_BIN $DARTC_FLAGS $APP_FILE > $DARTC_HOME/build.incr.txt |
| 57 |
| 58 # Generate output for the metrics collection |
| 59 SED_FULL_CMD="s/^[^#].*/${BENCH_NAME}-full-&/p" |
| 60 SED_INCR_CMD="s/^[^#].*/${BENCH_NAME}-incr-&/p" |
| 61 sed -ne $SED_FULL_CMD $DARTC_HOME/build.full.txt |
| 62 sed -ne $SED_INCR_CMD $DARTC_HOME/build.incr.txt |
| 63 |
| 64 # Cleanup compiled output and metrics captures |
| 65 rm -rf $DARTC_HOME/out $DARTC_HOME/build.full.txt $DARTC_HOME/build.incr.txt |
| 66 |
| 67 if [ ! "$? " = "0 " ]; then |
| 68 echo "ERROR: Compilation failed." 1>&2 |
| 69 exit 1 |
| 70 fi |
| 71 |
OLD | NEW |