Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: compiler/scripts/dartc_metrics.sh

Issue 10091038: Revert "Renamed the 'dartc' launch script to 'dart_analyzer' and adds it to dart-sdk" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiler/scripts/dartc_build_wrapper.py ('k') | compiler/scripts/dartc_run.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/scripts/dartc_metrics.sh
diff --git a/compiler/scripts/dartc_metrics.sh b/compiler/scripts/dartc_metrics.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b324223f03153f8552eb8cba05ba482d791e211a
--- /dev/null
+++ b/compiler/scripts/dartc_metrics.sh
@@ -0,0 +1,71 @@
+#!/bin/bash --posix
+#
+# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Compiles either TotalDart or Thump based on benchmark and reports
+# the metrics back to the collector.
+# Removes 'out' directory if one exists.
+
+# Determine where the libs are
+DARTC_HOME=`readlink -f .`
+DIST_DIR=$DARTC_HOME/compiler
+DARTC_BIN=$DIST_DIR/bin/dartc
+
+# A word about directories
+# The project directories are now copied before this script runs and we just have to change
+# in to the correct sub-directory to compile. We'll send the output of compiles and metrics
+# to the script directory instead of poluting the cache.
+LAST_ARG=`readlink -f ${!#}`
+BENCH_DIR=`dirname $LAST_ARG`
+
+# Big hack. We assume that the benchmark argument in the list:
+# x/y/dart/BenchmarkName.dart
+BENCH_NAME=`basename $LAST_ARG .dart`
+
+# Currently we only benchmark the compilation of two applications;
+# Redpill's Thump and Dart's Total.
+if [ $BENCH_NAME == "Total" ]; then
+ cd $BENCH_DIR/samples/total/src/
+ APP_FILE=Total.dart
+ DART_MAIN_FILE=Total.dart
+else
+ if [ $BENCH_NAME == "Thump" ]; then
+ cd $BENCH_DIR/samples/swarm
+ APP_FILE=swarm.dart
+ DART_MAIN_FILE=SwarmApp.dart
+ else
+ echo "ERROR: Compilation failed - benchmark ${BENCH_NAME} != Total | Thump" 1>&2
+ exit 1
+ fi
+fi
+
+DARTC_FLAGS="--metrics --out $DARTC_HOME/out "
+
+# Warmup period, run the compiler a few times to warm up the os/filesystem/etc
+# before collecting metrics
+$DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > /dev/null 2>&1
+rm -Rf $DARTC_HOME/out
+
+# Full compile metrics
+$DARTC_BIN $DARTC_FLAGS -noincremental $APP_FILE > $DARTC_HOME/build.full.txt
+
+# Single file delta incremental metrics
+touch $DART_MAIN_FILE
+$DARTC_BIN $DARTC_FLAGS $APP_FILE > $DARTC_HOME/build.incr.txt
+
+# Generate output for the metrics collection
+SED_FULL_CMD="s/^[^#].*/${BENCH_NAME}-full-&/p"
+SED_INCR_CMD="s/^[^#].*/${BENCH_NAME}-incr-&/p"
+sed -ne $SED_FULL_CMD $DARTC_HOME/build.full.txt
+sed -ne $SED_INCR_CMD $DARTC_HOME/build.incr.txt
+
+# Cleanup compiled output and metrics captures
+rm -rf $DARTC_HOME/out $DARTC_HOME/build.full.txt $DARTC_HOME/build.incr.txt
+
+if [ ! "$? " = "0 " ]; then
+ echo "ERROR: Compilation failed." 1>&2
+ exit 1
+fi
+
« no previous file with comments | « compiler/scripts/dartc_build_wrapper.py ('k') | compiler/scripts/dartc_run.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698