diff options
author | 2015-10-22 19:07:58 +0000 | |
---|---|---|
committer | 2015-10-22 19:07:58 +0000 | |
commit | 823e693aa946ba75cd047429e1290011a2ed8729 (patch) | |
tree | b382c6dfce38f2fa9cf7c3fe56f5ce9cebc89679 | |
parent | ec26f4b6c5b7b516ff5c12e660717860a45fe6d6 (diff) | |
parent | c237b392d30eda47b5c499e61bb3167574e13c1b (diff) |
Merge "Release ahat version 0.2."
-rw-r--r-- | tools/ahat/README.txt | 7 | ||||
-rw-r--r-- | tools/ahat/src/AhatSnapshot.java | 16 | ||||
-rw-r--r-- | tools/ahat/src/help.html | 35 |
3 files changed, 44 insertions, 14 deletions
diff --git a/tools/ahat/README.txt b/tools/ahat/README.txt index 1083c2f42f..5615f8f409 100644 --- a/tools/ahat/README.txt +++ b/tools/ahat/README.txt @@ -10,8 +10,6 @@ Usage: TODO: * Add more tips to the help page. - - Note that only 'app' heap matters, not 'zygote' or 'image'. - - Say what a dex cache is. - Recommend how to start looking at a heap dump. - Say how to enable allocation sites. - Where to submit feedback, questions, and bug reports. @@ -24,6 +22,7 @@ TODO: * Show site context and heap and class filter in "Objects" view? * Have a menu at the top of an object view with links to the sections? * Include ahat version and hprof file in the menu at the top of the page? + * Show root types. * Heaped Table - Make sortable by clicking on headers. - Use consistent order for heap columns. @@ -86,7 +85,6 @@ Perflib Requests: index. * What's the difference between getId and getUniqueId? * I see objects with duplicate references. - * Don't store stack trace by heap (CL 157252) * A way to get overall retained size by heap. * A method Instance.isReachable() @@ -97,6 +95,9 @@ Things to move to perflib: * Computing, for each instance, the other instances it dominates. Release History: + 0.2 Oct 20, 2015 + Take into account 'count' and 'offset' when displaying strings. + 0.1ss Aug 04, 2015 Enable stack allocations code (using custom modified perflib). Sort objects in 'objects/' with default sort. diff --git a/tools/ahat/src/AhatSnapshot.java b/tools/ahat/src/AhatSnapshot.java index 3035ef75c9..43658f33ef 100644 --- a/tools/ahat/src/AhatSnapshot.java +++ b/tools/ahat/src/AhatSnapshot.java @@ -18,14 +18,12 @@ package com.android.ahat; import com.android.tools.perflib.heap.ClassObj; import com.android.tools.perflib.heap.Heap; -import com.android.tools.perflib.heap.HprofParser; import com.android.tools.perflib.heap.Instance; import com.android.tools.perflib.heap.RootObj; import com.android.tools.perflib.heap.Snapshot; import com.android.tools.perflib.heap.StackFrame; import com.android.tools.perflib.heap.StackTrace; -import com.android.tools.perflib.heap.io.HprofBuffer; -import com.android.tools.perflib.heap.io.MemoryMappedFileBuffer; +import com.android.tools.perflib.captures.MemoryMappedFileBuffer; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import java.io.File; @@ -56,8 +54,7 @@ class AhatSnapshot { * Create an AhatSnapshot from an hprof file. */ public static AhatSnapshot fromHprof(File hprof) throws IOException { - HprofBuffer buffer = new MemoryMappedFileBuffer(hprof); - Snapshot snapshot = (new HprofParser(buffer)).parse(); + Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprof)); snapshot.computeDominators(); return new AhatSnapshot(snapshot); } @@ -185,20 +182,17 @@ class AhatSnapshot { // Return the stack where the given instance was allocated. private static StackTrace getStack(Instance inst) { - // TODO: return inst.getStack() once perflib is fixed. - return null; + return inst.getStack(); } // Return the list of stack frames for a stack trace. private static StackFrame[] getStackFrames(StackTrace stack) { - // TODO: Use stack.getFrames() once perflib is fixed. - return null; + return stack.getFrames(); } // Return the serial number of the given stack trace. private static int getStackTraceSerialNumber(StackTrace stack) { - // TODO: Use stack.getSerialNumber() once perflib is fixed. - return 0; + return stack.getSerialNumber(); } // Get the site associated with the given stack id and depth. diff --git a/tools/ahat/src/help.html b/tools/ahat/src/help.html index b48d79173f..b7ae2ceb43 100644 --- a/tools/ahat/src/help.html +++ b/tools/ahat/src/help.html @@ -54,3 +54,38 @@ limitations under the License. </ul> </li> </ul> + +<h2>Tips:</h2> +<h3>Heaps</h3> +<p> +Android heap dumps contain information for multiple heaps. The <b>app</b> heap +is the memory used by your application. The <b>zygote</b> and <b>image</b> +heaps are used by the system. You should ignore everything in the zygote and +image heap and look only at the app heap. This is because changes in your +application will not effect the zygote or image heaps, and because the zygote +and image heaps are shared, they don't contribute significantly to your +applications PSS. +</p> + +<h3>Bitmaps</h3> +<p> +Bitmaps store their data using byte[] arrays. Whenever you see a large +byte[], check if it is a bitmap by looking to see if there is a single +android.graphics.Bitmap object referring to it. The byte[] will be marked as a +root, but it is really being retained by the android.graphics.Bitmap object. +</p> + +<h3>DexCaches</h3> +<p> +For each DexFile you load, there will be a corresponding DexCache whose size +is proportional to the number of strings, fields, methods, and classes in your +dex file. The DexCache entries may or may not be visible depending on the +version of the Android platform the heap dump is from. +</p> + +<h3>FinalizerReferences</h3> +<p> +A FinalizerReference is allocated for every object on the heap that has a +non-trivial finalizer. These are stored in a linked list reachable from the +FinalizerReference class object. +</p> |