OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 # Start / stop profiling in chrome. | 7 # Start / stop profiling in chrome. |
8 | 8 |
9 # The profiling data is saved to directory /sdcard/Download. The files | 9 # The profiling data is saved to directory /sdcard/Download. The files |
10 # are named beginning chrome-profile-results- | 10 # are named beginning chrome-profile-results- |
11 # | 11 # |
12 # Assumes you have sourced the android build environment script | 12 # Assumes you have sourced the android build environment script |
13 # (e.g. 'adb' is on your path). | 13 # (e.g. 'adb' is on your path). |
14 set -e | 14 set -e |
15 | 15 |
16 usage() { | 16 usage() { |
17 echo "adb_profile_chrome [--start [-o file] [-c C]|--stop|-d|-t N] [-v N]" | 17 echo "adb_profile_chrome [--start [-o file] [-c C]|--stop|-d|-t N] [-v N]" |
18 echo "See http://dev.chromium.org/developers/how-tos/trace-event-profiling-too
l for detailed instructions on profiling." | 18 echo "See http://dev.chromium.org/developers/how-tos/trace-event-profiling-too
l for detailed instructions on profiling." |
19 echo "" | 19 echo "" |
20 echo " --start Start profiling." | 20 echo " --start Start profiling." |
21 echo " --output|-o file Save profile output to file. " | 21 echo " --output|-o file Save profile output to file. " |
22 echo " (Default is /sdcard/Download/chrome-profile-results
-*)" | 22 echo " (Default is /sdcard/Download/chrome-profile-results
-*)" |
23 echo " --categories|-c C Select categories to trace with comma-delimited wil
dcards." | 23 echo " --categories|-c C Select categories to trace with comma-delimited wil
dcards." |
24 echo " e.g. '*', 'cat1*,-cat1a'. Default is '*'." | 24 echo " e.g. '*', 'cat1*,-cat1a'. Default is '*'." |
| 25 echo " --continuous Using the trace buffer as a ring buffer, continuous
ly" |
| 26 echo " profile until stopped." |
25 echo " --stop Stop profiling." | 27 echo " --stop Stop profiling." |
26 echo " --download|-d Download latest trace." | 28 echo " --download|-d Download latest trace." |
27 echo " --time|-t N Profile for N seconds and download the resulting tr
ace." | 29 echo " --time|-t N Profile for N seconds and download the resulting tr
ace." |
28 echo " --version|v N Select among installed browsers." | 30 echo " --version|v N Select among installed browsers." |
29 echo " One of stable (default), beta, dev, build" | 31 echo " One of stable (default), beta, dev, build" |
30 echo "" | 32 echo "" |
31 echo "Profiling data is saved to the device." | 33 echo "Profiling data is saved to the device." |
32 exit 0 | 34 exit 0 |
33 } | 35 } |
34 | 36 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 OUTPUT="-e file '$2'" | 105 OUTPUT="-e file '$2'" |
104 shift | 106 shift |
105 ;; | 107 ;; |
106 -c|--categories) | 108 -c|--categories) |
107 if [ -z "$2" ]; then | 109 if [ -z "$2" ]; then |
108 usage | 110 usage |
109 fi | 111 fi |
110 CATEGORIES="-e categories '$2'" | 112 CATEGORIES="-e categories '$2'" |
111 shift | 113 shift |
112 ;; | 114 ;; |
| 115 --continuous) CONTINUOUS="-e continuous ." ;; |
113 -t|--time) | 116 -t|--time) |
114 shift | 117 shift |
115 if [ -z "$1" ] ; then | 118 if [ -z "$1" ] ; then |
116 usage | 119 usage |
117 fi | 120 fi |
118 INTERVAL="$1" | 121 INTERVAL="$1" |
119 ;; | 122 ;; |
120 -d|--download) | 123 -d|--download) |
121 shift | 124 shift |
122 download_latest_trace | 125 download_latest_trace |
123 echo "Trace written to ${PWD}/${LOCAL_TRACE_FILE}" | 126 echo "Trace written to ${PWD}/${LOCAL_TRACE_FILE}" |
124 ;; | 127 ;; |
125 *) usage ;; | 128 *) usage ;; |
126 esac | 129 esac |
127 shift | 130 shift |
128 done | 131 done |
129 | 132 |
130 if [ -z "${INTERVAL}" ] ; then | 133 if [ -z "${INTERVAL}" ] ; then |
131 if [ -z "${FUNCTION}" ] ; then | 134 if [ -z "${FUNCTION}" ] ; then |
132 usage | 135 usage |
133 else | 136 else |
134 send_intent ${PACKAGE} ${FUNCTION} ${OUTPUT} ${CATEGORIES} | 137 send_intent ${PACKAGE} ${FUNCTION} ${OUTPUT} ${CATEGORIES} ${CONTINUOUS} |
135 fi | 138 fi |
136 else | 139 else |
137 do_timed_capture ${PACKAGE} ${INTERVAL} ${CATEGORIES} | 140 do_timed_capture ${PACKAGE} ${INTERVAL} ${CATEGORIES} ${CONTINUOUS} |
138 fi | 141 fi |
139 exit 0 | 142 exit 0 |
OLD | NEW |