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

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

Issue 20722006: Removed compiler/ directory from repository (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
(Empty)
1 #!/bin/bash
2 #
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
5 # BSD-style license that can be found in the LICENSE file.
6
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,
9 # and out_compile_samples/ in the working direcetory, which are left
10 # around for later examination. These files will be destroyed on
11 # script re-run
12
13 DART_PARAMS="--metrics "
14 RUNS=3
15 ONE_DELTA=""
16 DART_ANALYZER=$(which dart_analyzer)
17 SAMPLE_DIR="."
18 PREFIX="sample"
19 SCRIPT_DIR=$(dirname $0)
20
21 source $SCRIPT_DIR/metrics_math.sh
22
23 function printHelp() {
24 exitValue=${1:1}
25 echo "Generate average and standard deviation compiler stats on a full compile , zero-delta compile,"
26 echo "and optional one-delta compile."
27 echo ""
28 echo " Usage:"
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"
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"
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)"
35 echo " -h, --help What you see is what you get."
36 echo " DART_APP Path to dart .app file to compile (depricated)"
37 exit $exitValue
38 }
39
40 if [ $# -eq 0 ]; then
41 printHelp;
42 fi
43
44 for i in $*
45 do
46 case $i in
47 --runs=*|-r=*)
48 RUNS=${i#*=};;
49 --one-delta=*|-d=*)
50 ONE_DELTA=${i#*=};;
51 --analyzer=*)
52 ANALYZER=${i#*=};;
53 --output=*|-o=*)
54 SAMPLE_DIR=${i#*=};;
55 --stats-prefix=*|-p=*)
56 if [ "" = "${i#*=}" ]; then
57 echo "prefix cannot be empty"
58 printHelp 1;
59 fi
60 PREFIX=${i#*=};;
61 --app=*|-a=*)
62 APP=${i#*=};;
63 --help|-h)
64 printHelp 0;;
65 -*)
66 echo "Parameter $i not recognized"
67 printHelp 1;;
68 *)
69 break;;
70 esac
71 done
72
73 if [ "" = "$ANALYZER" ] || [ ! -x $ANALYZER ]; then
74 echo "Error: Location of 'dart_analyzer' not found."
75 printHelp 1
76 fi
77
78 if [ "" = "$SAMPLE_DIR" ] || [ ! -d $SAMPLE_DIR ]; then
79 echo "Error: Invalid directory for samples location: $SAMPLE_DIR"
80 printHelp 1
81 fi
82
83 OUT_DIR=$SAMPLE_DIR/out_compile_samples
84 DART_PARAMS+="-out $OUT_DIR "
85
86 if [ "" = "$APP" ]; then
87 APP=$(echo $@ | sed -n 's/.*\s\(\S*\.app\).*/\1/p')
88 fi
89 if [ "" = "$APP" ] || [ ! -r $APP ]; then
90 echo "Error: Must specify app file, got: $APP"
91 printHelp 1
92 fi
93
94 APP_RELATIVE=`dirname $APP`
95 if [ "" != "$ONE_DELTA" ]; then
96 ONE_DELTA="$APP_RELATIVE/$ONE_DELTA"
97 if [ ! -r $ONE_DELTA ]; then
98 echo "Error, one_delta file, $ONE_DELTA, does not exist"
99 printHelp
100 fi
101 fi
102
103 SAMPLE_FULL=$SAMPLE_DIR/$PREFIX-full.txt
104 SAMPLE_INCR_ZERO=$SAMPLE_DIR/$PREFIX-incr-zero.txt
105 SAMPLE_INCR_ONE=$SAMPLE_DIR/$PREFIX-incr-one.txt
106
107 #clean up
108 rm -Rf $SAMPLE_FULL $SAMPLE_INCR_ZERO $SAMPLE_INCR_ONE
109
110 for ((i=0;i<$RUNS;i++)) do
111 echo "Run $i"
112 rm -Rf $OUT_DIR
113 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_FULL
114 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ZERO
115 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then
116 touch $ONE_DELTA
117 $ANALYZER $DART_PARAMS $APP >> $SAMPLE_INCR_ONE
118 fi
119 done
120
121 sample_file "full-compile" "Compile-time-total-ms" "$SAMPLE_FULL"
122 sample_file "zero-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ZERO"
123 if [ -e $ONE_DELTA ] && [ "" != "$ONE_DELTA" ]; then
124 sample_file "one-delta-compile" "Compile-time-total-ms" "$SAMPLE_INCR_ONE"
125 fi
126
127
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698