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

Side by Side Diff: platform_tools/android/bin/android_perf

Issue 262053007: Fix android_perf script to work with changes from a137675 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # android_perf: utility for running perf on an android device 3 # android_perf: utility for running perf on an android device
4 # 4 #
5 # The basic usage sequence is to run... 5 # The basic usage sequence is to run...
6 # 1) perf record [gm/tests/bench] # runs profiler on specified app 6 # 1) perf record [gm/tests/bench] # runs profiler on specified app
7 # 2) perf report # prints profiler results 7 # 2) perf report # prints profiler results
8 # 3) perf clean # cleans the temporary directory used to store results 8 # 3) perf clean # cleans the temporary directory used to store results
9 # 9 #
10 10
11 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 11 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12 source $SCRIPT_DIR/android_setup.sh 12 source $SCRIPT_DIR/android_setup.sh
13 source $SCRIPT_DIR/utils/setup_adb.sh 13 source $SCRIPT_DIR/utils/setup_adb.sh
14 14
15 if [ $(uname) == "Linux" ]; then 15 if [ $(uname) == "Linux" ]; then
16 PERFHOST=$SCRIPT_DIR/linux/perfhost 16 PERFHOST=$SCRIPT_DIR/linux/perfhost
17 elif [ $(uname) == "Darwin" ]; then 17 elif [ $(uname) == "Darwin" ]; then
18 PERFHOST=$SCRIPT_DIR/mac/perfhost 18 PERFHOST=$SCRIPT_DIR/mac/perfhost
19 else 19 else
20 echo "Could not automatically determine OS!" 20 echo "Could not automatically determine OS!"
21 exit 1; 21 exit 1;
22 fi 22 fi
23 23
24 # grab and remove the perf command from the input args 24 # grab and remove the perf command from the input args
25 PERF_CMD=${APP_ARGS[0]} 25 PERF_CMD=${APP_ARGS[0]}
26 unset APP_ARGS[0] 26 unset APP_ARGS[0]
27 27 runVars=("${APP_ARGS[@]}") # shift array indices
28 configuration="Debug"
29
30 for arg in ${APP_ARGS[@]}
31 do
32 if [[ "${arg}" == "--release" ]];
33 then
34 configuration="Release"
35 else
36 echo "${arg}"
37 runVars=("${runVars[@]}" "${arg}")
38 fi
39
40 shift
41 done
42 28
43 # We need the debug symbols from these files 29 # We need the debug symbols from these files
44 PERF_TMP_DIR=$(pwd)/android_perf_tmp 30 PERF_TMP_DIR=$(pwd)/android_perf_tmp
45 31
46 TMP_SYS_BIN=$PERF_TMP_DIR/system/bin 32 TMP_SYS_BIN=$PERF_TMP_DIR/system/bin
47 TMP_SYS_LIB=$PERF_TMP_DIR/system/lib 33 TMP_SYS_LIB=$PERF_TMP_DIR/system/lib
48 TMP_APP_LOC=$PERF_TMP_DIR/data/local/tmp 34 TMP_APP_LOC=$PERF_TMP_DIR/data/local/tmp
49 35
50 perf_setup() { 36 perf_setup() {
51 37
52 mkdir -p $TMP_SYS_BIN 38 mkdir -p $TMP_SYS_BIN
53 mkdir -p $TMP_SYS_LIB 39 mkdir -p $TMP_SYS_LIB
54 mkdir -p $TMP_APP_LOC 40 mkdir -p $TMP_APP_LOC
55 41
56 echo "Copying symbol files" 42 echo "Copying symbol files"
57 adb_pull_if_needed /system/lib/libc.so $TMP_SYS_LIB 43 adb_pull_if_needed /system/lib/libc.so $TMP_SYS_LIB
58 adb_pull_if_needed /system/lib/libstlport.so $TMP_SYS_LIB 44 adb_pull_if_needed /system/lib/libstlport.so $TMP_SYS_LIB
59 adb_pull_if_needed /system/lib/libcutils.so $TMP_SYS_LIB 45 adb_pull_if_needed /system/lib/libcutils.so $TMP_SYS_LIB
60 adb_pull_if_needed /system/lib/libGLESv2.so $TMP_SYS_LIB 46 adb_pull_if_needed /system/lib/libGLESv2.so $TMP_SYS_LIB
61 adb_pull_if_needed /system/lib/libandroid.so $TMP_SYS_LIB 47 adb_pull_if_needed /system/lib/libandroid.so $TMP_SYS_LIB
62 adb_pull_if_needed /system/lib/libm.so $TMP_SYS_LIB 48 adb_pull_if_needed /system/lib/libm.so $TMP_SYS_LIB
63 adb_pull_if_needed /system/lib/libz.so $TMP_SYS_LIB 49 adb_pull_if_needed /system/lib/libz.so $TMP_SYS_LIB
64 50
65 if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ]; 51 # BUILDTYPE variable is set by android_setup.sh
52 BUILDDIR="${SKIA_OUT}/${BUILDTYPE}"
53 if [ ! -f "${BUILDDIR}/lib/lib${runVars[0]}.so" ];
66 then 54 then
67 echo "Unable to find the ${runVars[0]} library" 55 echo "Unable to find the ${runVars[0]} library in ${BUILDDIR}/lib."
68 exit 1 56 exit 1
69 fi 57 fi
70 58
71 echo "Pushing app..." 59 echo "Pushing app..."
72 adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/ tmp 60 for lib_file in \
73 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android. so" /data/local/tmp 61 "${BUILDDIR}/skia_launcher" \
74 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]} .so" /data/local/tmp 62 "${BUILDDIR}/lib/libskia_android.so" \
75 63 "${BUILDDIR}/lib/lib${runVars[0]}.so" \
76 cp "${SKIA_OUT}/${configuration}/skia_launcher" $TMP_APP_LOC 64 ; do
77 cp "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" $TMP_APP_LOC 65 adb_push_if_needed "$lib_file" /data/local/tmp
78 cp "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" $TMP_APP_LO C 66 cp "$lib_file" $TMP_APP_LOC
67 done
79 } 68 }
80 69
81 perf_record() { 70 perf_record() {
82 71
83 echo "Killing any running Skia processes." 72 echo "Killing any running Skia processes."
84 $ADB shell ps | grep skia_launcher | awk '{print $2}' | xargs $ADB shell kil l 73 $ADB shell ps | grep skia_launcher | awk '{print $2}' | xargs $ADB shell kil l
85 74
86 echo "Starting application" 75 echo "Starting application"
87 $ADB shell /data/local/tmp/skia_launcher ${runVars[@]} & 76 $ADB shell /data/local/tmp/skia_launcher ${runVars[@]} &
88 77
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 perf_clean 112 perf_clean
124 ;; 113 ;;
125 *) 114 *)
126 echo -n "ERROR: unknown perf command ($PERF_CMD), valid values: " 115 echo -n "ERROR: unknown perf command ($PERF_CMD), valid values: "
127 echo "setup, record, report, clean" 116 echo "setup, record, report, clean"
128 exit 1; 117 exit 1;
129 ;; 118 ;;
130 esac 119 esac
131 120
132 exit 0; 121 exit 0;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698