}
}
+ if (is_android) {
+ copy("gdbserver") {
+ sources = [
+ "$ndk/$ndk_gdbserver",
+ ]
+ outputs = [
+ "$root_out_dir/gdbserver",
+ ]
+ }
+ if (ndk_simpleperf != "") {
+ copy("simpleperf") {
+ sources = [
+ "$ndk/$ndk_simpleperf",
+ "$ndk/simpleperf/simpleperf_report.py",
+ ]
+ outputs = [
+ "$root_out_dir/{{source_file_part}}",
+ ]
+ }
+ }
+ }
+
if (skia_enable_gpu) {
test_app("skslc") {
sources = [
ndk_platform = ""
ndk_stdlib = ""
ndk_gccdir = ""
+ ndk_gdbserver = ""
+ ndk_simpleperf = ""
if (host_os == "linux") {
ndk_host = "linux-x86_64"
ndk_platform = "android-${ndk_api}/arch-arm64"
ndk_stdlib = "arm64-v8a"
ndk_gccdir = ndk_target
+ ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver"
+ ndk_simpleperf = "simpleperf/android/arm64/simpleperf"
} else if (target_cpu == "arm") {
ndk_target = "arm-linux-androideabi"
ndk_platform = "android-${ndk_api}/arch-arm"
ndk_stdlib = "armeabi-v7a"
ndk_gccdir = ndk_target
+ ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver"
+ ndk_simpleperf = "simpleperf/android/arm/simpleperf"
} else if (target_cpu == "mips64el") {
ndk_target = "mips64el-linux-android"
ndk_platform = "android-${ndk_api}/arch-mips64"
ndk_stdlib = "mips64"
ndk_gccdir = ndk_target
+ ndk_gdbserver = "prebuilt/android-mips64/gdbserver/gdbserver"
} else if (target_cpu == "mipsel") {
ndk_target = "mipsel-linux-android"
ndk_platform = "android-${ndk_api}/arch-mips"
ndk_stdlib = "mips"
ndk_gccdir = ndk_target
+ ndk_gdbserver = "prebuilt/android-mips/gdbserver/gdbserver"
} else if (target_cpu == "x64") {
ndk_target = "x86_64-linux-android"
ndk_platform = "android-${ndk_api}/arch-x86_64"
ndk_stdlib = "x86_64"
ndk_gccdir = ndk_stdlib
+ ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver"
+ ndk_simpleperf = "simpleperf/android/x86_64/simpleperf"
} else if (target_cpu == "x86") {
ndk_target = "i686-linux-android"
ndk_platform = "android-${ndk_api}/arch-x86"
ndk_stdlib = "x86"
ndk_gccdir = ndk_stdlib
+ ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
+ ndk_simpleperf = "simpleperf/android/x86/simpleperf"
}
}
source $SCRIPT_DIR/utils/android_setup.sh
# setup the gdbserver
-$SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]}
+$SCRIPT_DIR/android_gdbserver -C ${SKIA_OUT} ${APP_ARGS[@]}
# quit if gdbserver setup failed
if [[ "$?" != "0" ]]; then
adb_push_if_needed "${TARGET_EXE}" /data/local/tmp
echo "Pushing gdbserver..."
-adb_push_if_needed $GDBSERVER_DIR/gdbserver/gdbserver /data/local/tmp
+adb_push_if_needed $SKIA_OUT/gdbserver /data/local/tmp
echo "Setting up port forward"
$ADB forward "tcp:5039" "tcp:5039"
# TODO: check to ensure that the app exists on the device and prompt to install
if [[ -n $RESOURCE_PATH ]]; then
- adb_push_if_needed "${SKIA_SRC_DIR}/resources" $RESOURCE_PATH
+ adb_push_if_needed "${SCRIPT_DIR}/../../../resources" $RESOURCE_PATH
fi
activity="org.skia.viewer/org.skia.viewer.ViewerActivity"
source $SCRIPT_DIR/utils/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
-if [ $(uname) == "Linux" ]; then
- PERFHOST=$SCRIPT_DIR/linux/perfhost
-elif [ $(uname) == "Darwin" ]; then
- PERFHOST=$SCRIPT_DIR/mac/perfhost
-else
- echo "Could not automatically determine OS!"
- exit 1;
-fi
-
# grab and remove the perf command from the input args
PERF_CMD=${APP_ARGS[0]}
unset APP_ARGS[0]
echo "Copying symbol files"
adb_pull_if_needed /system/lib/libc.so $TMP_SYS_LIB
adb_pull_if_needed /system/lib/libstdc++.so $TMP_SYS_LIB
- adb_pull_if_needed /system/lib/libstlport.so $TMP_SYS_LIB
adb_pull_if_needed /system/lib/libGLESv2.so $TMP_SYS_LIB
adb_pull_if_needed /system/lib/libandroid.so $TMP_SYS_LIB
adb_pull_if_needed /system/lib/libm.so $TMP_SYS_LIB
exit 1
fi
+ echo "Pushing simpleperf..."
+ adb_push_if_needed $SKIA_OUT/simpleperf /data/local/tmp
+
echo "Pushing app..."
adb_push_if_needed "${SKIA_OUT}/${runVars[0]}" /data/local/tmp
cp "${SKIA_OUT}/${runVars[0]}" $TMP_APP_LOC
# TO BE READ BY THE REPORTING TOOL
echo "Starting profiler"
APP_PID=$($ADB shell ps | grep ${runVars[0]} | awk '{print $2}')
- $ADB shell perf record -p ${APP_PID} sleep 70
+ $ADB shell /data/local/tmp/simpleperf record -p ${APP_PID} -o /data/local/tmp/perf.data sleep 70
- $ADB pull /data/perf.data $PERF_TMP_DIR/perf.data
+ $ADB pull /data/local/tmp/perf.data $PERF_TMP_DIR/perf.data
exit 0;
}
perf_report() {
- adb_pull_if_needed /data/perf.data $PERF_TMP_DIR/perf.data
- $PERFHOST report -i $PERF_TMP_DIR/perf.data --symfs=$PERF_TMP_DIR ${runVars[@]}
+ adb_pull_if_needed /data/local/tmp/perf.data $PERF_TMP_DIR/perf.data
+ $SKIA_OUT/perfhost_report.py -i $PERF_TMP_DIR/perf.data --symfs=$PERF_TMP_DIR ${runVars[@]}
}
# Clean up
adb_push_if_needed "${SKIA_OUT}/${APP_ARGS[0]}" /data/local/tmp
if [[ -n $RESOURCE_PATH ]]; then
verbose "pushing resources onto the device..."
- adb_push_if_needed "${SKIA_SRC_DIR}/resources" $RESOURCE_PATH
+ adb_push_if_needed "${SCRIPT_DIR}/../../../resources" $RESOURCE_PATH
fi
if [ $LOGCAT ]; then
fi
fi
-if [ -z "$ANDROID_HOME" ]; then
- echo "ANDROID_HOME not set so we are setting it to a default value of ANDROID_SDK_ROOT"
- exportVar ANDROID_HOME $ANDROID_SDK_ROOT
-fi
-
if [ -z "$ANDROID_NDK_ROOT" ]; then
if [ -d "${ANDROID_SDK_ROOT}/ndk-bundle" ]; then
exportVar ANDROID_NDK_ROOT ${ANDROID_SDK_ROOT}/ndk-bundle