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

Side by Side Diff: runtime/observatory/lib/src/elements/heap_snapshot.dart

Issue 1811713002: Perform a full GC by default when requesting a heap snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months 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 4
5 library heap_snapshot_element; 5 library heap_snapshot_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/app.dart'; 10 import 'package:observatory/app.dart';
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 Future refresh() { 402 Future refresh() {
403 return _getHeapSnapshot(); 403 return _getHeapSnapshot();
404 } 404 }
405 405
406 Future _getHeapSnapshot() { 406 Future _getHeapSnapshot() {
407 var completer = new Completer(); 407 var completer = new Completer();
408 state = "Requesting heap snapshot..."; 408 state = "Requesting heap snapshot...";
409 isolate.getClassRefs(); 409 isolate.getClassRefs();
410
411 bool collectGarbage =
412 app.locationManager.getBoolParameter('collectGarbage', true);
413
410 var stopwatch = new Stopwatch()..start(); 414 var stopwatch = new Stopwatch()..start();
411 isolate.fetchHeapSnapshot().listen((event) { 415 isolate.fetchHeapSnapshot(collectGarbage).listen((event) {
412 if (event is String) { 416 if (event is String) {
413 print("${stopwatch.elapsedMilliseconds} $event"); 417 print("${stopwatch.elapsedMilliseconds} $event");
414 state = event; 418 state = event;
415 } else if (event is HeapSnapshot) { 419 } else if (event is HeapSnapshot) {
416 snapshot = event; 420 snapshot = event;
417 state = 'Loaded'; 421 state = 'Loaded';
418 completer.complete(snapshot); 422 completer.complete(snapshot);
419 _update(); 423 _update();
420 } else { 424 } else {
421 throw "Unexpected event $event"; 425 throw "Unexpected event $event";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 460
457 new Future.delayed(const Duration(milliseconds: 500), () { 461 new Future.delayed(const Duration(milliseconds: 500), () {
458 buildMergedVertices(snapshot.graph).then((vertices) { 462 buildMergedVertices(snapshot.graph).then((vertices) {
459 state = 'Loaded'; 463 state = 'Loaded';
460 var rootRow = new MergedVerticesRow(tree, null, isolate, vertices); 464 var rootRow = new MergedVerticesRow(tree, null, isolate, vertices);
461 tree.initialize(rootRow); 465 tree.initialize(rootRow);
462 }); 466 });
463 }); 467 });
464 } 468 }
465 } 469 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698