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

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 var collectGarbage =
412 app.locationManager.uri.queryParameters['collectGarbage'];
Cutch 2016/03/17 15:37:32 Maybe a helper function like bool getBoolParameter
rmacnak 2016/03/17 18:09:08 Done.
413 if (collectGarbage == null) {
414 collectGarbage = true;
415 }
416
410 var stopwatch = new Stopwatch()..start(); 417 var stopwatch = new Stopwatch()..start();
411 isolate.fetchHeapSnapshot().listen((event) { 418 isolate.fetchHeapSnapshot(collectGarbage).listen((event) {
412 if (event is String) { 419 if (event is String) {
413 print("${stopwatch.elapsedMilliseconds} $event"); 420 print("${stopwatch.elapsedMilliseconds} $event");
414 state = event; 421 state = event;
415 } else if (event is HeapSnapshot) { 422 } else if (event is HeapSnapshot) {
416 snapshot = event; 423 snapshot = event;
417 state = 'Loaded'; 424 state = 'Loaded';
418 completer.complete(snapshot); 425 completer.complete(snapshot);
419 _update(); 426 _update();
420 } else { 427 } else {
421 throw "Unexpected event $event"; 428 throw "Unexpected event $event";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 463
457 new Future.delayed(const Duration(milliseconds: 500), () { 464 new Future.delayed(const Duration(milliseconds: 500), () {
458 buildMergedVertices(snapshot.graph).then((vertices) { 465 buildMergedVertices(snapshot.graph).then((vertices) {
459 state = 'Loaded'; 466 state = 'Loaded';
460 var rootRow = new MergedVerticesRow(tree, null, isolate, vertices); 467 var rootRow = new MergedVerticesRow(tree, null, isolate, vertices);
461 tree.initialize(rootRow); 468 tree.initialize(rootRow);
462 }); 469 });
463 }); 470 });
464 } 471 }
465 } 472 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698