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

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

Issue 1124153006: Heap snapshot visualizations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync Created 5 years, 7 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 | Annotate | Revision Log
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 4
5 library heap_profile_element; 5 library heap_profile_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';
11 import 'package:observatory/service.dart'; 11 import 'package:observatory/service.dart';
12 import 'package:observatory/elements.dart'; 12 import 'package:observatory/elements.dart';
13 import 'package:polymer/polymer.dart'; 13 import 'package:polymer/polymer.dart';
14 14
15 class ClassSortedTable extends SortedTable { 15 class ClassSortedTable extends SortedTable {
16 16
17 ClassSortedTable(columns) : super(columns); 17 ClassSortedTable(columns) : super(columns);
18 18
19 @override 19 @override
20 dynamic getSortKeyFor(int row, int col) { 20 dynamic getSortKeyFor(int row, int col) {
21 if (col == 0) { 21 if (col == 0) {
22 // Use class name as sort key. 22 // Use class name as sort key.
23 return rows[row].values[col].name; 23 return rows[row].values[col].name;
24 } 24 }
25 return super.getSortKeyFor(row, col); 25 return super.getSortKeyFor(row, col);
26 } 26 }
27 } 27 }
28 28
29 /// Displays an Error response.
30 @CustomTag('heap-profile') 29 @CustomTag('heap-profile')
31 class HeapProfileElement extends ObservatoryElement { 30 class HeapProfileElement extends ObservatoryElement {
32 @observable String lastServiceGC = '---'; 31 @observable String lastServiceGC = '---';
33 @observable String lastAccumulatorReset = '---'; 32 @observable String lastAccumulatorReset = '---';
34 33
35 // Pie chart of new space usage. 34 // Pie chart of new space usage.
36 var _newPieDataTable; 35 var _newPieDataTable;
37 var _newPieChart; 36 var _newPieChart;
38 37
39 // Pie chart of old space usage. 38 // Pie chart of old space usage.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 _classTableBody = shadowRoot.querySelector('#classTableBody'); 95 _classTableBody = shadowRoot.querySelector('#classTableBody');
97 _subscription = app.vm.gcEvents.where( 96 _subscription = app.vm.gcEvents.where(
98 (event) => event.isolate == isolate).listen(_onEvent); 97 (event) => event.isolate == isolate).listen(_onEvent);
99 } 98 }
100 99
101 @override 100 @override
102 void detached() { 101 void detached() {
103 _subscription.cancel(); 102 _subscription.cancel();
104 super.detached(); 103 super.detached();
105 } 104 }
106 105
107 // Keep at most one outstanding auto-refresh RPC. 106 // Keep at most one outstanding auto-refresh RPC.
108 bool refreshAutoPending = false; 107 bool refreshAutoPending = false;
109 bool refreshAutoQueued = false; 108 bool refreshAutoQueued = false;
110 109
111 void _onEvent(ServiceEvent event) { 110 void _onEvent(ServiceEvent event) {
112 if (autoRefresh && event.eventType == 'GC') { 111 if (autoRefresh && event.eventType == 'GC') {
113 if (!refreshAutoPending) { 112 if (!refreshAutoPending) {
114 refreshAuto(); 113 refreshAuto();
115 } else { 114 } else {
116 // Remember to refresh once more, to ensure latest profile. 115 // Remember to refresh once more, to ensure latest profile.
117 refreshAutoQueued = true; 116 refreshAutoQueued = true;
118 } 117 }
119 } 118 }
120 } 119 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 classRef.ref = row.values[0]; 224 classRef.ref = row.values[0];
226 225
227 for (var i = 1; i < row.values.length; i++) { 226 for (var i = 1; i < row.values.length; i++) {
228 if (SPACER_COLUMNS.contains(i)) { 227 if (SPACER_COLUMNS.contains(i)) {
229 // Skip spacer columns. 228 // Skip spacer columns.
230 continue; 229 continue;
231 } 230 }
232 var cell = tr.children[i]; 231 var cell = tr.children[i];
233 cell.title = row.values[i].toString(); 232 cell.title = row.values[i].toString();
234 cell.text = classTable.getFormattedValue(rowIndex, i); 233 cell.text = classTable.getFormattedValue(rowIndex, i);
234 if (i > 1) { // Numbers.
235 cell.style.textAlign = 'right';
236 }
235 } 237 }
236 } 238 }
237 239
238 void _updateClassTableInDom() { 240 void _updateClassTableInDom() {
239 assert(_classTableBody != null); 241 assert(_classTableBody != null);
240 // Resize DOM table. 242 // Resize DOM table.
241 if (_classTableBody.children.length > classTable.sortedRows.length) { 243 if (_classTableBody.children.length > classTable.sortedRows.length) {
242 // Shrink the table. 244 // Shrink the table.
243 var deadRows = 245 var deadRows =
244 _classTableBody.children.length - classTable.sortedRows.length; 246 _classTableBody.children.length - classTable.sortedRows.length;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 363 }
362 364
363 @observable String formattedTotalCollectionTime(bool newSpace) { 365 @observable String formattedTotalCollectionTime(bool newSpace) {
364 if (profile == null) { 366 if (profile == null) {
365 return ''; 367 return '';
366 } 368 }
367 var heap = newSpace ? isolate.newSpace : isolate.oldSpace; 369 var heap = newSpace ? isolate.newSpace : isolate.oldSpace;
368 return '${Utils.formatSeconds(heap.totalCollectionTimeInSeconds)} secs'; 370 return '${Utils.formatSeconds(heap.totalCollectionTimeInSeconds)} secs';
369 } 371 }
370 } 372 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.dart ('k') | runtime/observatory/lib/src/elements/heap_snapshot.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698