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

Side by Side Diff: compiler/scripts/analyzer_metrics.sh

Issue 9950019: Renamed the 'dartc' launch script to 'dart-analysis' and adds it to dart-sdk (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Short circuit the copying of dart_analyzer completely from the build Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, 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 # Collects compiler statics for a given Dart app and spits them out 7 # Collects compiler statics for a given Dart app and spits them out
8 # Creates sample-full.txt, sample-incr-zero.txt, sample-incr-one.txt, 8 # Creates sample-full.txt, sample-incr-zero.txt, sample-incr-one.txt,
9 # and out_compile_samples/ in the working direcetory, which are left 9 # and out_compile_samples/ in the working direcetory, which are left
10 # around for later examination. These files will be destroyed on 10 # around for later examination. These files will be destroyed on
11 # script re-run 11 # script re-run
12 12
13 DART_PARAMS="--metrics " 13 DART_PARAMS="--metrics "
14 RUNS=3 14 RUNS=3
15 ONE_DELTA="" 15 ONE_DELTA=""
16 DARTC=$(which dartc) 16 DART_ANALYZER=$(which dart_analyzer)
17 SAMPLE_DIR="." 17 SAMPLE_DIR="."
18 PREFIX="sample" 18 PREFIX="sample"
19 SCRIPT_DIR=$(dirname $0) 19 SCRIPT_DIR=$(dirname $0)
20 20
21 source $SCRIPT_DIR/metrics_math.sh 21 source $SCRIPT_DIR/metrics_math.sh
22 22
23 function printHelp() { 23 function printHelp() {
24 exitValue=${1:1} 24 exitValue=${1:1}
25 echo "Generate average and standard deviation compiler stats on a full compile , zero-delta compile," 25 echo "Generate average and standard deviation compiler stats on a full compile , zero-delta compile,"
26 echo "and optional one-delta compile." 26 echo "and optional one-delta compile."
27 echo "" 27 echo ""
28 echo " Usage:" 28 echo " Usage:"
29 echo " -a=, --app= The dart app file to test (required)." 29 echo " -a=, --app= The dart app file to test (required)."
30 echo " -r=, --runs= Set the number of compile samples to be executed. Defaults to $RUNS" 30 echo " -r=, --runs= Set the number of compile samples to be executed. Defaults to $RUNS"
31 echo " -d=, --one-delta= The filename, relative to DART_APP, to touch in or der to trigger a one-delta compile." 31 echo " -d=, --one-delta= The filename, relative to DART_APP, to touch in or der to trigger a one-delta compile."
32 echo " -o=, --output= Directory location of sample storage" 32 echo " -o=, --output= Directory location of sample storage"
33 echo " --dartc= Override PATH location for dartc script" 33 echo " --analyzer= Override PATH location for analyzer script"
34 echo " -p, --stats-prefix= Adds prefix to each output file (default: sample-[ full|incri-[one|zero]]).txt)" 34 echo " -p, --stats-prefix= Adds prefix to each output file (default: sample-[ full|incri-[one|zero]]).txt)"
35 echo " -h, --help What you see is what you get." 35 echo " -h, --help What you see is what you get."
36 echo " DART_APP Path to dart .app file to compile (depricated)" 36 echo " DART_APP Path to dart .app file to compile (depricated)"
37 exit $exitValue 37 exit $exitValue
38 } 38 }
39 39
40 if [ $# -eq 0 ]; then 40 if [ $# -eq 0 ]; then
41 printHelp; 41 printHelp;
42 fi 42 fi
43 43
44 for i in $* 44 for i in $*
45 do 45 do
46 case $i in 46 case $i in
47 --runs=*|-r=*) 47 --runs=*|-r=*)
48 RUNS=${i#*=};; 48 RUNS=${i#*=};;
49 --one-delta=*|-d=*) 49 --one-delta=*|-d=*)
50 ONE_DELTA=${i#*=};; 50 ONE_DELTA=${i#*=};;
51 --dartc=*) 51 --analyzer=*)
52 DARTC=${i#*=};; 52 ANALYZER=${i#*=};;
53 --output=*|-o=*) 53 --output=*|-o=*)
54 SAMPLE_DIR=${i#*=};; 54 SAMPLE_DIR=${i#*=};;
55 --stats-prefix=*|-p=*) 55 --stats-prefix=*|-p=*)
56 if [ "" = "${i#*=}" ]; then 56 if [ "" = "${i#*=}" ]; then
57 echo "prefix cannot be empty" 57 echo "prefix cannot be empty"
58 printHelp 1; 58 printHelp 1;
59 fi 59 fi
60 PREFIX=${i#*=};; 60 PREFIX=${i#*=};;
61 --app=*|-a=*) 61 --app=*|-a=*)
62 APP=${i#*=};; 62 APP=${i#*=};;
63 --help|-h) 63 --help|-h)
64 printHelp 0;; 64 printHelp 0;;
65 -*) 65 -*)
66 echo "Parameter $i not recognized" 66 echo "Parameter $i not recognized"
67 printHelp 1;; 67 printHelp 1;;
68 *) 68 *)
69 break;; 69 break;;
70 esac 70 esac
71 done 71 done
72 72
73 if [ "" = "$DARTC" ] || [ ! -x $DARTC ]; then 73 if [ "" = "$ANALYZER" ] || [ ! -x $ANALYZER ]; then
74 echo "Error: Location of 'dartc' not found." 74 echo "Error: Location of 'dart_analyzer' not found."
75 printHelp 1 75 printHelp 1
76 fi 76 fi
77 77
78 if [ "" = "$SAMPLE_DIR" ] || [ ! -d $SAMPLE_DIR ]; then 78 if [ "" = "$SAMPLE_DIR" ] || [ ! -d $SAMPLE_DIR ]; then
79 echo "Error: Invalid directory for samples location: $SAMPLE_DIR" 79 echo "Error: Invalid directory for samples location: $SAMPLE_DIR"
80 printHelp 1 80 printHelp 1
81 fi 81 fi
82 82
83 OUT_DIR=$SAMPLE_DIR/out_compile_samples 83 OUT_DIR=$SAMPLE_DIR/out_compile_samples
84 DART_PARAMS+="-out $OUT_DIR " 84 DART_PARAMS+="-out $OUT_DIR "
(...skipping 18 matching lines...) Expand all
103 SAMPLE_FULL=$SAMPLE_DIR/$PREFIX-full.txt 103 SAMPLE_FULL=$SAMPLE_DIR/$PREFIX-full.txt
104 SAMPLE_INCR_ZERO=$SAMPLE_DIR/$PREFIX-incr-zero.txt 104 SAMPLE_INCR_ZERO=$SAMPLE_DIR/$PREFIX-incr-zero.txt
105 SAMPLE_INCR_ONE=$SAMPLE_DIR/$PREFIX-incr-one.txt 105 SAMPLE_INCR_ONE=$SAMPLE_DIR/$PREFIX-incr-one.txt
106 106
107 #clean up 107 #clean up
108 rm -Rf $SAMPLE_FULL $SAMPLE_INCR_ZERO $SAMPLE_INCR_ONE 108 rm -Rf $SAMPLE_FULL $SAMPLE_INCR_ZERO $SAMPLE_INCR_ONE
109 109
110 for ((i=0;i<$RUNS;i++)) do 110 for ((i=0;i<$RUNS;i++)) do
111 echo "Run $i" 111 echo "Run $i"
112 rm -Rf $OUT_DIR 112 rm -Rf $OUT_DIR
113 $DARTC $DART_PARAMS $APP >> $SAMPLE_FULL 113 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_FULL
114 $DARTC $DART_PARAMS $APP >> $SAMPLE_INCR_ZERO 114 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ZERO
115 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then 115 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then
116 touch $ONE_DELTA 116 touch $ONE_DELTA
117 $DARTC $DART_PARAMS $APP >> $SAMPLE_INCR_ONE 117 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ONE
118 fi 118 fi
119 done 119 done
120 120
121 sample_file "full-compile" "Compile-time-total-ms" "$SAMPLE_FULL" 121 sample_file "full-compile" "Compile-time-total-ms" "$SAMPLE_FULL"
122 sample_file "zero-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ZERO" 122 sample_file "zero-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ZERO"
123 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then 123 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then
124 sample_file "one-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ONE" 124 sample_file "one-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ONE"
125 fi 125 fi
126 126
127 127
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698