facebook / stetho

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.
http://facebook.github.io/stetho/
MIT License
12.67k stars 1.13k forks source link

Implement Profiles tab (heap profiling) #92

Open jasta opened 9 years ago

jasta commented 9 years ago

This may be possible using a private API that powers DDMS' lame Allocation Tracking UI: https://android.googlesource.com/platform/libcore/+/android-5.1.0_r1/dalvik/src/main/java/org/apache/harmony/dalvik/ddmc/DdmVmInternal.java

This API has been stable for a very long time AFAICT (I looked all the way back to Ice Cream Sandwich). I believe it will continue to be stable as well.

The format of the getRecentAllocations method is defined by ddmlib: https://android.googlesource.com/platform/tools/base/+/android-5.1.0_r1/ddmlib/src/main/java/com/android/ddmlib/AllocationsParser.java

The major issue to overcome is the seemingly incomplete heapsnapshot file format that Chrome uses. In particular, there's limited UI and file format support for allocation stack traces and the format exported/imported by DevTools appears to even lose the limited information that does currently exist. Upstream discussion started at: https://code.google.com/p/chromium/issues/detail?id=277984#c34

jasta commented 9 years ago

@paulirish any chance you have some context on this? In particular, with: https://code.google.com/p/chromium/issues/detail?id=277984#c34?

paulirish commented 9 years ago

Seems like a good bug. Can you file a new one? On Mar 13, 2015 2:44 PM, "Josh Guilfoyle" notifications@github.com wrote:

@paulirish https://github.com/paulirish any chance you have some context on this? In particular, with: https://code.google.com/p/chromium/issues/detail?id=277984#c34?

— Reply to this email directly or view it on GitHub https://github.com/facebook/stetho/issues/92#issuecomment-79442606.

jasta commented 9 years ago

Filed upstream as: https://code.google.com/p/chromium/issues/detail?id=467222

jasta commented 9 years ago

Upstream is implementing the required changes, we're back in business! Go Chromium team!

jasta commented 9 years ago

@paulirish any chance you can help out here? The activity on https://code.google.com/p/chromium/issues/detail?id=467222 has mysteriously stalled just shy of having this perfectly wired up for our purposes. The only bug remaining is that allocation stack traces are not recalled from the new .heaptimeline file format.

paulirish commented 9 years ago

Sorry. We've had some activity in the project recently that had delayed our look at this. If you can help me with a patch file I'll get it through code review. On Apr 30, 2015 4:09 PM, "Josh Guilfoyle" notifications@github.com wrote:

@paulirish https://github.com/paulirish any chance you can help out here? The activity on https://code.google.com/p/chromium/issues/detail?id=467222 has mysteriously stalled just shy of having this perfectly wired up for our purposes. The only bug remaining is that allocation stack traces are not recalled from the new .heaptimeline file format.

— Reply to this email directly or view it on GitHub https://github.com/facebook/stetho/issues/92#issuecomment-97996397.

jasta commented 9 years ago

Woohoo! Upstream finished the feature!

ghost commented 9 years ago

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

jasta commented 9 years ago

Bump. We need to keep this alive, though the implementation is seriously delayed due to unforeseen issues in the Dalvik/ART support for allocation profiling.