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- |
(...skipping 26 matching lines...) Expand all Loading... |
37 local INTENT=$2 | 37 local INTENT=$2 |
38 shift | 38 shift |
39 shift | 39 shift |
40 adb shell am broadcast -a $PACKAGE.$INTENT $* | 40 adb shell am broadcast -a $PACKAGE.$INTENT $* |
41 } | 41 } |
42 | 42 |
43 download_latest_trace() { | 43 download_latest_trace() { |
44 TRACE_FILE=$(adb logcat -d | \ | 44 TRACE_FILE=$(adb logcat -d | \ |
45 grep "Logging performance trace to file: " | \ | 45 grep "Logging performance trace to file: " | \ |
46 tail -1 | \ | 46 tail -1 | \ |
47 sed -E "s/.*\/storage\/emulated\/.+\/([^\r]+).*/\/sdcard\/Download\/\\1/") | 47 perl -pi -e "s/.*\/storage\/emulated\/.+\/([^\r]+).*/\/sdcard\/Download\/\
\1/g") |
48 if [ -z "$TRACE_FILE" ]; then | 48 if [ -z "$TRACE_FILE" ]; then |
49 echo "Unable to determine trace file name" | 49 echo "Unable to determine trace file name" |
50 exit 1 | 50 exit 1 |
51 fi | 51 fi |
52 | 52 |
53 adb pull $TRACE_FILE 2> /dev/null | 53 adb pull $TRACE_FILE 2> /dev/null |
54 LOCAL_TRACE_FILE=$(basename $TRACE_FILE) | 54 LOCAL_TRACE_FILE=$(basename $TRACE_FILE) |
55 if [ ! -f "$LOCAL_TRACE_FILE" ]; then | 55 if [ ! -f "$LOCAL_TRACE_FILE" ]; then |
56 echo "Unable to download trace file" | 56 echo "Unable to download trace file" |
57 exit 1 | 57 exit 1 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if [ -z "${INTERVAL}" ] ; then | 130 if [ -z "${INTERVAL}" ] ; then |
131 if [ -z "${FUNCTION}" ] ; then | 131 if [ -z "${FUNCTION}" ] ; then |
132 usage | 132 usage |
133 else | 133 else |
134 send_intent ${PACKAGE} ${FUNCTION} ${OUTPUT} ${CATEGORIES} | 134 send_intent ${PACKAGE} ${FUNCTION} ${OUTPUT} ${CATEGORIES} |
135 fi | 135 fi |
136 else | 136 else |
137 do_timed_capture ${PACKAGE} ${INTERVAL} ${CATEGORIES} | 137 do_timed_capture ${PACKAGE} ${INTERVAL} ${CATEGORIES} |
138 fi | 138 fi |
139 exit 0 | 139 exit 0 |
OLD | NEW |