Why can't I get an HPROF dump from certain devices?
Asked Answered
T

1

5

As has been detailed by many helpful sites, one way to analyze memory usage of Android apps is to execute a "kill -10 [PID]" to trigger an HPROF dump. This seems to work on some devices, and the logcat normally contains something like this:

I/dalvikvm(32170): threadid=3: reacting to signal 10
I/dalvikvm(32170): SIGUSR1 forcing GC and HPROF dump
I/dalvikvm(32170): hprof: dumping VM heap to "/data/misc/heap-dump-tm1302633572-pid32170.hprof-hptemp".
I/dalvikvm(32170): hprof: dumping heap strings to "/data/misc/heap-dump-tm1302633572-    pid32170.hprof".
I/dalvikvm(32170): hprof: heap dump completed, temp file removed

However, on other devices, executing the "kill -10" results in this:

I/dalvikvm( 5687): threadid=4: reacting to signal 10
I/dalvikvm( 5687): SIGUSR1 forcing GC (no HPROF)

All the devices I'm trying this on are rooted and I've made sure to chmod /data/misc to 777. I don't get any error messages after executing "kill -10".

In case it's helpful, here are the devices where I do get an HPROF dump: HTC ACE (Desire HD), HTC G1, HTC Nexus One (T-Mobile)

And here are the devices where I do NOT get an HPROF dump: Nexus S, Droid, Droid X, Nexus One (AT&T)

Why can't I get an HPROF dump from certain devices and is there anything I can do to allow me to get the dumps?

Trisa answered 12/4, 2011 at 18:56 Comment(0)
C
8

Use DDMS. Click on the "Dump HPROF File" toolbar icon -- it looks like a half-full can with a downward-pointing arrow. Worked like a charm when I tried it just now on a Nexus S.

Craftsman answered 13/4, 2011 at 2:28 Comment(8)
Excellent, thank you. Looks like this also saves me from having to convert it with hprof-conv.Trisa
here's the diff which disabled the feature: android.git.kernel.org/?p=platform/…Eipper
To be clear for future readers, the feature @Jan Berkel is referring to is the SIGUSR1 to force an HPROF dump that the OP used to use. The DDMS HPROF approach still works AFAIK.Craftsman
That link no longer works, by the by. It redirects to hereRezzani
i wish the android team would support stable links to commits, here's the updated link: android.googlesource.com/platform/dalvik/+/…Eipper
Is there an Eclipse option that shows/hides the DDMS HPROF dump icon? I used to see it (half-full can with downward pointing arrow) when I was in the DDMS perspective, but now it's gone (?).Bosun
@gcl1: If it is not in the toolbar of your Devices view, click the little drop-arrow on the right side of that toolbar, and see if it appears there.Craftsman
@CommonsWare: Thanks, I just needed to expose the Devices view. All set!Bosun

© 2022 - 2024 — McMap. All rights reserved.