adb: add script to trace adbd.

Bug: http://b/31289465
Test: sh trace.sh
Change-Id: Id6e20e83742541aec6bfd9f4112adbdadc078f74
This commit is contained in:
Josh Gao 2016-12-13 14:24:12 -08:00
parent 2361ab0d31
commit 52df920fd6
2 changed files with 17 additions and 0 deletions

0
adb/sysdeps_win32_test.cpp Executable file → Normal file
View file

17
adb/trace.sh Executable file
View file

@ -0,0 +1,17 @@
set -e
if ! [ -e $ANDROID_BUILD_TOP/external/chromium-trace/systrace.py ]; then
echo "error: can't find systrace.py at \$ANDROID_BUILD_TOP/external/chromium-trace/systrace.py"
exit 1
fi
adb shell "sleep 1; atrace -b 65536 --async_start adb sched power freq idle disk mmc load"
adb shell killall adbd
adb wait-for-device
echo "press enter to finish..."
read
TRACE_TEMP=`mktemp /tmp/trace.XXXXXX`
echo Saving trace to ${TRACE_TEMP}, html file to ${TRACE_TEMP}.html
adb shell atrace --async_stop -z > ${TRACE_TEMP}
$ANDROID_BUILD_TOP/external/chromium-trace/systrace.py --from-file=${TRACE_TEMP} -o ${TRACE_TEMP}.html
chrome ${TRACE_TEMP}.html