Chromium Code Reviews| Index: runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart |
| diff --git a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart |
| index 37c6bf56410f98611dc21caf071fdfd21e1ac6df..1e1af79bff1052be8c3d4a80f6bd62730dd2fd7f 100644 |
| --- a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart |
| +++ b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart |
| @@ -13,6 +13,7 @@ class HeapSnapshot implements M.HeapSnapshot { |
| HeapSnapshotDominatorNode dominatorTree; |
| HeapSnapshotMergedDominatorNode mergedDominatorTree; |
| List<MergedVertex> classReferences; |
| + List<OwnershipClass> ownershipClasses; |
| static Future sleep([Duration duration = const Duration(microseconds: 0)]) { |
| final Completer completer = new Completer(); |
| @@ -40,6 +41,7 @@ class HeapSnapshot implements M.HeapSnapshot { |
| mergedDominatorTree = |
| new HeapSnapshotMergedDominatorNode(isolate, graph.mergedRoot); |
| classReferences = await buildMergedVertices(isolate, graph, signal); |
| + ownershipClasses = buildOwnershipClasses(isolate, graph); |
| progress.close(); |
| }()); |
| return progress.stream; |
| @@ -100,6 +102,18 @@ class HeapSnapshot implements M.HeapSnapshot { |
| return cidToMergedVertex.values.toList(); |
| } |
| + buildOwnershipClasses(S.Isolate isolate, ObjectGraph graph) { |
| + var numCids = graph.numCids; |
| + var classes = new List(); |
| + for (var cid = 0; cid < numCids; cid++) { |
| + var size = graph.getOwnedByCid(cid); |
| + if (size != 0) { |
| + classes.add(new OwnershipClass(cid, isolate, size)); |
| + } |
| + } |
| + return classes; |
| + } |
| + |
| List<Future<S.ServiceObject>> getMostRetained(S.Isolate isolate, |
| {int classId, int limit}) { |
| var result = []; |
| @@ -267,3 +281,12 @@ class HeapSnapshotClassOutbound implements M.HeapSnapshotClassOutbound { |
| HeapSnapshotClassOutbound(this.vertex, this.edge); |
| } |
| + |
| +class OwnershipClass { |
|
cbernaschina
2017/08/29 21:07:00
ditto
rmacnak
2017/08/29 23:59:34
Done.
|
| + final int cid; |
| + final S.Isolate isolate; |
| + S.Class get clazz => isolate.getClassByCid(cid); |
| + final int size; |
| + |
| + OwnershipClass(this.cid, this.isolate, this.size); |
| +} |