diff options
author | Calin Juravle <calin@google.com> | 2014-10-20 15:58:57 +0100 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-10-20 17:42:50 +0100 |
commit | aa98061dd65b7449999ce3f48088e24df693a042 (patch) | |
tree | 9ac8da80ba45a11a9caba557011366ee7ec0effb /tools/art | |
parent | e09c0fc7ce4b522f8b3e981572d6fa4954b95878 (diff) | |
download | art-aa98061dd65b7449999ce3f48088e24df693a042.tar.gz art-aa98061dd65b7449999ce3f48088e24df693a042.tar.bz2 art-aa98061dd65b7449999ce3f48088e24df693a042.zip |
Add perf option to art tool
'art --perf' will record user space cycle information
'art --perf-report' will also report the saved data.
When using perf, the temporary data directory is not deleted.
Change-Id: Iadceeb3883f815cac8ed2b8a96b9b8363661d156
Diffstat (limited to 'tools/art')
-rw-r--r-- | tools/art | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -53,6 +53,12 @@ while true; do elif [ "$1" = "--64" ]; then DALVIKVM=dalvikvm64 shift + elif [ "$1" = "--perf" ]; then + PERF="record" + shift + elif [ "$1" = "--perf-report" ]; then + PERF="report" + shift elif expr "$1" : "--" >/dev/null 2>&1; then echo "unknown option: $1" 1>&2 exit 1 @@ -68,6 +74,11 @@ ANDROID_DATA=$PWD/android-data$$ LIBDIR=$(find_libdir) LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBDIR + +if [ z"$PERF" != z ]; then + invoke_with="perf record -o $ANDROID_DATA/perf.data -e cycles:u $invoke_with" +fi + mkdir -p $ANDROID_DATA/dalvik-cache/{arm,arm64,x86,x86_64} ANDROID_DATA=$ANDROID_DATA \ ANDROID_ROOT=$ANDROID_ROOT \ @@ -75,7 +86,18 @@ ANDROID_DATA=$ANDROID_DATA \ $invoke_with $ANDROID_ROOT/bin/$DALVIKVM $lib \ -XXlib:$LIBART \ -Ximage:$ANDROID_ROOT/framework/core.art \ - "$@" + -Xcompiler-option --include-debug-symbols \ + "$@" + EXIT_STATUS=$? -rm -rf $ANDROID_DATA + +if [ z"$PERF" != z ]; then + if [ z"$PERF" = zreport ]; then + perf report -i $ANDROID_DATA/perf.data + fi + echo "Perf data saved in: $ANDROID_DATA/perf.data" +else + rm -rf $ANDROID_DATA +fi + exit $EXIT_STATUS |