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

Unified Diff: runtime/observatory/tests/service/object_graph_stack_reference_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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/object_graph_stack_reference_test.dart
diff --git a/runtime/observatory/tests/service/object_graph_stack_reference_test.dart b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9fc88ce4958832afc16bfa2cf03b5cacef48e0e6
--- /dev/null
+++ b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'dart:developer';
+
+import 'test_helper.dart';
+import 'service_test_common.dart';
+
+import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:observatory/object_graph.dart';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+int arrayLength = 1024 * 1024;
+int minArraySize = arrayLength * 4;
+
+void script() {
+ var stackSlot = new List(arrayLength);
+ debugger();
+ print(stackSlot); // Prevent optimizing away the stack slot.
+}
+
+checkForStackReferent(Isolate isolate) async {
+ Library corelib =
+ isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core');
+ await corelib.load();
+ Class _List =
+ corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List'));
+ int kArrayCid = _List.vmCid;
+
+ RawHeapSnapshot raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
+ HeapSnapshot snapshot = new HeapSnapshot();
+ await snapshot.loadProgress(isolate, raw).last;
+ ObjectGraph graph = snapshot.graph;
+
+ var root = graph.root;
+ var stack = graph.root.dominatorTreeChildren()
+ .singleWhere((child) => child.isStack);
+ expect(stack.retainedSize, greaterThanOrEqualTo(minArraySize));
+
+ bool foundBigArray = false;
+ for (var stackReferent in stack.dominatorTreeChildren()) {
+ if (stackReferent.vmCid == kArrayCid &&
+ stackReferent.shallowSize >= minArraySize) {
+ foundBigArray = true;
+ }
+ }
+}
+
+var tests = [
+ hasStoppedAtBreakpoint,
+ checkForStackReferent,
+ resumeIsolate,
+];
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: script);
« no previous file with comments | « runtime/observatory/tests/service/graph_test.dart ('k') | runtime/observatory/tests/service/object_graph_user_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698