diff options
Diffstat (limited to 'tools/ahat/src/ObjectsHandler.java')
-rw-r--r-- | tools/ahat/src/ObjectsHandler.java | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tools/ahat/src/ObjectsHandler.java b/tools/ahat/src/ObjectsHandler.java index 4cfb0a55cf..3062d23b53 100644 --- a/tools/ahat/src/ObjectsHandler.java +++ b/tools/ahat/src/ObjectsHandler.java @@ -16,7 +16,10 @@ package com.android.ahat; -import com.android.tools.perflib.heap.Instance; +import com.android.ahat.heapdump.AhatInstance; +import com.android.ahat.heapdump.AhatSnapshot; +import com.android.ahat.heapdump.Site; +import com.android.ahat.heapdump.Sort; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -33,17 +36,16 @@ class ObjectsHandler implements AhatHandler { @Override public void handle(Doc doc, Query query) throws IOException { - int stackId = query.getInt("stack", 0); + int id = query.getInt("id", 0); int depth = query.getInt("depth", 0); String className = query.get("class", null); String heapName = query.get("heap", null); - Site site = mSnapshot.getSite(stackId, depth); + Site site = mSnapshot.getSite(id, depth); - List<Instance> insts = new ArrayList<Instance>(); - for (Instance inst : site.getObjects()) { + List<AhatInstance> insts = new ArrayList<AhatInstance>(); + for (AhatInstance inst : site.getObjects()) { if ((heapName == null || inst.getHeap().getName().equals(heapName)) - && (className == null - || AhatSnapshot.getClassName(inst.getClassObj()).equals(className))) { + && (className == null || inst.getClassName().equals(className))) { insts.add(inst); } } @@ -51,16 +53,22 @@ class ObjectsHandler implements AhatHandler { Collections.sort(insts, Sort.defaultInstanceCompare(mSnapshot)); doc.title("Objects"); + doc.table( new Column("Size", Column.Align.RIGHT), + new Column("Δ", Column.Align.RIGHT, mSnapshot.isDiffed()), new Column("Heap"), new Column("Object")); - SubsetSelector<Instance> selector = new SubsetSelector(query, OBJECTS_ID, insts); - for (Instance inst : selector.selected()) { + + SubsetSelector<AhatInstance> selector = new SubsetSelector(query, OBJECTS_ID, insts); + for (AhatInstance inst : selector.selected()) { + AhatInstance base = inst.getBaseline(); doc.row( - DocString.format("%,d", inst.getSize()), + DocString.format("%,14d", inst.getSize()), + DocString.delta(inst.isPlaceHolder(), base.isPlaceHolder(), + inst.getSize(), base.getSize()), DocString.text(inst.getHeap().getName()), - Value.render(mSnapshot, inst)); + Summarizer.summarize(inst)); } doc.end(); selector.render(doc); |