Search This Blog

Saturday, February 14, 2015

Dalvik Heap Profiling

have a look at this post
http://stackoverflow.com/questions/25795458/is-it-possible-to-trigger-an-android-heap-dump-from-the-command-line
watch this video from 35 minutes Android Development Tools 

from code you can use Debug.dumpHprofData()
from adb you can use kill -10   explain well here -> Dalvik Heap Profiling


adb am dumpheap


use this link to get more info heap-profiling

From a shell you can do the following to get a heap dump for the application using adb.
Note: Replace 19000 with the process ID of your running application. The filepath must be a filepath which your application has write access to on the Android device.
Create a heap dump:
adb shell am dumpheap 19000 /sdcard/Documents/android.hprof
Pull the file to your machine:
adb pull /sdcard/Documents/android.hprof
Convert to a hprof file readable by an analyzer:
hprof-conv android.hprof mat.hprof
Tips: Get process ID of your application:
adb shell ps | grep com.sample.application | cut -c10-15
Get process ID and dump heap:
adb shell am dumpheap `adb shell ps | grep com.sample.application | cut -c10-15` /sdcard/Documents/android.hprof

No comments: