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

Side by Side Diff: runtime/observatory/tests/service/graph_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/object_graph.dart'; 7 import 'package:observatory/object_graph.dart';
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
(...skipping 25 matching lines...) Expand all
36 int fooId; 36 int fooId;
37 37
38 var tests = [ 38 var tests = [
39 39
40 (Isolate isolate) async { 40 (Isolate isolate) async {
41 Library lib = await isolate.rootLibrary.load(); 41 Library lib = await isolate.rootLibrary.load();
42 expect(lib.classes.length, equals(1)); 42 expect(lib.classes.length, equals(1));
43 Class fooClass = lib.classes.first; 43 Class fooClass = lib.classes.first;
44 fooId = fooClass.vmCid; 44 fooId = fooClass.vmCid;
45 45
46 RawHeapSnapshot raw = await isolate.fetchHeapSnapshot(false).last; 46 RawHeapSnapshot raw = await isolate.fetchHeapSnapshot("VM", false).last;
Cutch 2016/11/18 20:40:31 ditto
47 HeapSnapshot snapshot = new HeapSnapshot(); 47 HeapSnapshot snapshot = new HeapSnapshot();
48 await snapshot.loadProgress(isolate, raw).last; 48 await snapshot.loadProgress(isolate, raw).last;
49 ObjectGraph graph = snapshot.graph; 49 ObjectGraph graph = snapshot.graph;
50 50
51 expect(fooId, isNotNull); 51 expect(fooId, isNotNull);
52 Iterable<ObjectVertex> foos = graph.vertices.where( 52 Iterable<ObjectVertex> foos = graph.vertices.where(
53 (ObjectVertex obj) => obj.vmCid == fooId); 53 (ObjectVertex obj) => obj.vmCid == fooId);
54 expect(foos.length, equals(3)); 54 expect(foos.length, equals(3));
55 expect(foos.where((obj) => obj.successors.length == 0).length, 55 expect(foos.where((obj) => obj.successors.length == 0).length,
56 equals(1)); 56 equals(1));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 expect(first.successors.length, 92 expect(first.successors.length,
93 equals(2 + second.successors.length)); 93 equals(2 + second.successors.length));
94 // ... and specifically, that it retains exactly itself + the long one. 94 // ... and specifically, that it retains exactly itself + the long one.
95 expect(first.retainedSize, 95 expect(first.retainedSize,
96 equals(first.shallowSize + second.shallowSize)); 96 equals(first.shallowSize + second.shallowSize));
97 }, 97 },
98 98
99 ]; 99 ];
100 100
101 main(args) => runIsolateTests(args, tests, testeeBefore: script); 101 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698