Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Side by Side Diff: runtime/observatory/tests/service/dominator_tree_vm_test.dart

Issue 2502283003: Add a version of heap snapshots that use only fields and stack frames as roots and only include ins… (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/heap_snapshot.dart'; 6 import 'package:observatory/heap_snapshot.dart';
7 import 'package:observatory/models.dart' as M;
7 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart'; 10 import 'test_helper.dart';
10 11
11 // small example from [Lenguaer & Tarjan 1979] 12 // small example from [Lenguaer & Tarjan 1979]
12 class R { var x; var y; var z; } 13 class R { var x; var y; var z; }
13 class A { var x; } 14 class A { var x; }
14 class B { var x; var y; var z; } 15 class B { var x; var y; var z; }
15 class C { var x; var y; } 16 class C { var x; var y; }
16 class D { var x; } 17 class D { var x; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 h.x = e; h.y = k; 52 h.x = e; h.y = k;
52 i.x = k; 53 i.x = k;
53 j.x = i; 54 j.x = i;
54 k.x = i; k.y = r; 55 k.x = i; k.y = r;
55 l.x = h; 56 l.x = h;
56 } 57 }
57 58
58 var tests = [ 59 var tests = [
59 (Isolate isolate) async { 60 (Isolate isolate) async {
60 final rootLib = await isolate.rootLibrary.load(); 61 final rootLib = await isolate.rootLibrary.load();
61 final raw = await isolate.fetchHeapSnapshot(false).last; 62 final raw =
63 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, false).last;
62 final snapshot = new HeapSnapshot(); 64 final snapshot = new HeapSnapshot();
63 await snapshot.loadProgress(isolate, raw).last; 65 await snapshot.loadProgress(isolate, raw).last;
64 66
65 node(String className) { 67 node(String className) {
66 var cls = rootLib.classes.singleWhere((cls) => cls.name == className); 68 var cls = rootLib.classes.singleWhere((cls) => cls.name == className);
67 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid); 69 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid);
68 } 70 }
69 71
70 expect(node('I').dominator, equals(node('R'))); 72 expect(node('I').dominator, equals(node('R')));
71 expect(node('K').dominator, equals(node('R'))); 73 expect(node('K').dominator, equals(node('R')));
72 expect(node('C').dominator, equals(node('R'))); 74 expect(node('C').dominator, equals(node('R')));
73 expect(node('H').dominator, equals(node('R'))); 75 expect(node('H').dominator, equals(node('R')));
74 expect(node('E').dominator, equals(node('R'))); 76 expect(node('E').dominator, equals(node('R')));
75 expect(node('A').dominator, equals(node('R'))); 77 expect(node('A').dominator, equals(node('R')));
76 expect(node('D').dominator, equals(node('R'))); 78 expect(node('D').dominator, equals(node('R')));
77 expect(node('B').dominator, equals(node('R'))); 79 expect(node('B').dominator, equals(node('R')));
78 80
79 expect(node('F').dominator, equals(node('C'))); 81 expect(node('F').dominator, equals(node('C')));
80 expect(node('G').dominator, equals(node('C'))); 82 expect(node('G').dominator, equals(node('C')));
81 expect(node('J').dominator, equals(node('G'))); 83 expect(node('J').dominator, equals(node('G')));
82 expect(node('L').dominator, equals(node('D'))); 84 expect(node('L').dominator, equals(node('D')));
83 85
84 expect(node('R'), isNotNull); // The field. 86 expect(node('R'), isNotNull); // The field.
85 }, 87 },
86 ]; 88 ];
87 89
88 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph); 90 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698