diff options
author | Andy McFadden <fadden@android.com> | 2010-07-12 08:00:19 -0700 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2010-07-14 12:43:11 -0700 |
commit | b628985c9b330e955833189b4bb4c998fe18527d (patch) | |
tree | 78d212f0d430b03cc8ebfea8aa80b00351d14d50 /envsetup.sh | |
parent | ad8aec94faa3c08b990110bbe12484eadc897839 (diff) | |
download | build-b628985c9b330e955833189b4bb4c998fe18527d.zip build-b628985c9b330e955833189b4bb4c998fe18527d.tar.gz build-b628985c9b330e955833189b4bb4c998fe18527d.tar.bz2 |
Update runhat command to use "am dumpheap".
Instead of sending a kill -10 to write a file to /data/misc, we now use
"am dumpheap" to create a file on /sdcard.
Also,
- Removed mention of unused "output-file" argument.
- Quoted args in initial tests so bash doesn't go nuts when you say
"runhat" with no arguments.
Bug 2835170.
Change-Id: I614fdb54a1d6b8824bc9b568c07cc0901c41a3d4
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/envsetup.sh b/envsetup.sh index 8323cce..0ddbd4d 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -907,10 +907,10 @@ function runhat() { # process standard adb options local adbTarget="" - if [ $1 = "-d" -o $1 = "-e" ]; then + if [ "$1" = "-d" -o "$1" = "-e" ]; then adbTarget=$1 shift 1 - elif [ $1 = "-s" ]; then + elif [ "$1" = "-s" ]; then adbTarget="$1 $2" shift 2 fi @@ -919,10 +919,9 @@ function runhat() # runhat options local targetPid=$1 - local outputFile=$2 if [ "$targetPid" = "" ]; then - echo "Usage: runhat [ -d | -e | -s serial ] target-pid [output-file]" + echo "Usage: runhat [ -d | -e | -s serial ] target-pid" return fi @@ -932,18 +931,14 @@ function runhat() return fi - adb ${adbOptions} shell >/dev/null mkdir /data/misc - adb ${adbOptions} shell chmod 777 /data/misc - - # send a SIGUSR1 to cause the hprof dump + # issue "am" command to cause the hprof dump + local devFile=/sdcard/hprof-$targetPid echo "Poking $targetPid and waiting for data..." - adb ${adbOptions} shell kill -10 $targetPid + adb ${adbOptions} shell am dumpheap $targetPid $devFile echo "Press enter when logcat shows \"hprof: heap dump completed\"" echo -n "> " read - local availFiles=( $(adb ${adbOptions} shell ls /data/misc | grep '^heap-dump' | sed -e 's/.*heap-dump-/heap-dump-/' | sort -r | tr '[:space:][:cntrl:]' ' ') ) - local devFile=/data/misc/${availFiles[0]} local localFile=/tmp/$$-hprof echo "Retrieving file $devFile..." |