Chromium Code Reviews| Index: runtime/observatory/lib/object_graph.dart |
| =================================================================== |
| --- runtime/observatory/lib/object_graph.dart (revision 42649) |
| +++ runtime/observatory/lib/object_graph.dart (working copy) |
| @@ -38,6 +38,8 @@ |
| class ObjectVertex { |
| // Never null. The isolate root has id 0. |
| final int _id; |
| + // TODO(koda): Include units in object graph metadata. |
| + int addressForWordSize(int bytesPerWord) => _id * 2 * bytesPerWord; |
| // null for VM-heap objects. |
| int _shallowSize; |
| int get shallowSize => _shallowSize; |
| @@ -75,12 +77,27 @@ |
| _addFrom(reader); |
| } |
| _computeRetainedSizes(); |
| + _mostRetained = new List<ObjectVertex>.from( |
| + vertices.where((u) => u.classId != 0)); |
|
Cutch
2015/01/07 00:25:26
Perhaps make this magic number into a const and do
koda
2015/01/09 18:46:55
Added 'isRoot' getter.
|
| + _mostRetained.sort((u, v) => v.retainedSize - u.retainedSize); |
| } |
| Iterable<ObjectVertex> get vertices => _idToVertex.values; |
| + List<ObjectVertex> _mostRetained; |
| ObjectVertex get root => _asVertex(0); |
| + Iterable<ObjectVertex> getMostRetained({int classId, int limit}) { |
| + var result = _mostRetained; |
| + if (classId != null) { |
| + result = result.where((u) => u.classId == classId); |
| + } |
| + if (limit != null) { |
| + result = result.take(limit); |
| + } |
| + return result; |
| + } |
| + |
| void _computeRetainedSizes() { |
| // The retained size for an object is the sum of the shallow sizes of |
| // all its descendants in the dominator tree (including itself). |