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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/heap_profile.dart

Issue 269813011: Show new and old space separately in allocation profile (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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:html'; 7 import 'dart:html';
8 import 'observatory_element.dart'; 8 import 'observatory_element.dart';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 27 matching lines...) Expand all
38 38
39 HeapProfileElement.created() : super.created() { 39 HeapProfileElement.created() : super.created() {
40 _newPieDataTable = new DataTable(); 40 _newPieDataTable = new DataTable();
41 _newPieDataTable.addColumn('string', 'Type'); 41 _newPieDataTable.addColumn('string', 'Type');
42 _newPieDataTable.addColumn('number', 'Size'); 42 _newPieDataTable.addColumn('number', 'Size');
43 _oldPieDataTable = new DataTable(); 43 _oldPieDataTable = new DataTable();
44 _oldPieDataTable.addColumn('string', 'Type'); 44 _oldPieDataTable.addColumn('string', 'Type');
45 _oldPieDataTable.addColumn('number', 'Size'); 45 _oldPieDataTable.addColumn('number', 'Size');
46 var columns = [ 46 var columns = [
47 new SortedTableColumn('Class'), 47 new SortedTableColumn('Class'),
48 new SortedTableColumn.withFormatter('Accumulator', 48 new SortedTableColumn.withFormatter('Accumulator Size (New)',
49 Utils.formatSize), 49 Utils.formatSize),
50 new SortedTableColumn.withFormatter('Accumulator', 50 new SortedTableColumn.withFormatter('Accumulator (New)',
51 Utils.formatCommaSeparated), 51 Utils.formatCommaSeparated),
52 new SortedTableColumn.withFormatter('Accumulator (Old space)', 52 new SortedTableColumn.withFormatter('Current Size (New)',
53 Utils.formatSize), 53 Utils.formatSize),
54 new SortedTableColumn.withFormatter('Accumulator (Old space)', 54 new SortedTableColumn.withFormatter('Current (New)',
55 Utils.formatCommaSeparated), 55 Utils.formatCommaSeparated),
56 new SortedTableColumn.withFormatter('Current', 56 new SortedTableColumn.withFormatter('Accumulator Size (Old)',
57 Utils.formatSize), 57 Utils.formatSize),
58 new SortedTableColumn.withFormatter('Current', 58 new SortedTableColumn.withFormatter('Accumulator (Old)',
59 Utils.formatCommaSeparated),
60 new SortedTableColumn.withFormatter('Current Size (Old)',
61 Utils.formatSize),
62 new SortedTableColumn.withFormatter('Current (Old)',
59 Utils.formatCommaSeparated) 63 Utils.formatCommaSeparated)
60 ]; 64 ];
61 classTable = new SortedTable(columns); 65 classTable = new SortedTable(columns);
62 classTable.sortColumnIndex = 1; 66 classTable.sortColumnIndex = 1;
63 } 67 }
64 68
65 void enteredView() { 69 void enteredView() {
66 super.enteredView(); 70 super.enteredView();
67 _newPieChart = new Chart('PieChart', 71 _newPieChart = new Chart('PieChart',
68 shadowRoot.querySelector('#newPieChart')); 72 shadowRoot.querySelector('#newPieChart'));
(...skipping 15 matching lines...) Expand all
84 if (_classHasNoAllocations(cls)) { 88 if (_classHasNoAllocations(cls)) {
85 // If a class has no allocations, don't display it. 89 // If a class has no allocations, don't display it.
86 continue; 90 continue;
87 } 91 }
88 var row = [cls['class'], 92 var row = [cls['class'],
89 _combinedTableColumnValue(cls, 1), 93 _combinedTableColumnValue(cls, 1),
90 _combinedTableColumnValue(cls, 2), 94 _combinedTableColumnValue(cls, 2),
91 _combinedTableColumnValue(cls, 3), 95 _combinedTableColumnValue(cls, 3),
92 _combinedTableColumnValue(cls, 4), 96 _combinedTableColumnValue(cls, 4),
93 _combinedTableColumnValue(cls, 5), 97 _combinedTableColumnValue(cls, 5),
94 _combinedTableColumnValue(cls, 6)]; 98 _combinedTableColumnValue(cls, 6),
99 _combinedTableColumnValue(cls, 7),
100 _combinedTableColumnValue(cls, 8)];
95 classTable.addRow(new SortedTableRow(row)); 101 classTable.addRow(new SortedTableRow(row));
96 } 102 }
97 classTable.sort(); 103 classTable.sort();
98 _newPieDataTable.clearRows(); 104 _newPieDataTable.clearRows();
99 var heap = profile['heaps']['new']; 105 var heap = profile['heaps']['new'];
100 _newPieDataTable.addRow(['Used', heap['used']]); 106 _newPieDataTable.addRow(['Used', heap['used']]);
101 _newPieDataTable.addRow(['Free', heap['capacity'] - heap['used']]); 107 _newPieDataTable.addRow(['Free', heap['capacity'] - heap['used']]);
102 _newPieDataTable.addRow(['External', heap['external']]); 108 _newPieDataTable.addRow(['External', heap['external']]);
103 _oldPieDataTable.clearRows(); 109 _oldPieDataTable.clearRows();
104 heap = profile['heaps']['old']; 110 heap = profile['heaps']['old'];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 for (var allocation in oldSpace) { 142 for (var allocation in oldSpace) {
137 if (allocation != 0) { 143 if (allocation != 0) {
138 return false; 144 return false;
139 } 145 }
140 } 146 }
141 return true; 147 return true;
142 } 148 }
143 149
144 dynamic _combinedTableColumnValue(Map v, int index) { 150 dynamic _combinedTableColumnValue(Map v, int index) {
145 assert(index >= 0); 151 assert(index >= 0);
146 assert(index < 7); 152 assert(index < 9);
147 switch (index) { 153 switch (index) {
148 case 0: 154 case 0:
149 return v['class']['user_name']; 155 return v['class']['user_name'];
150 case 1: 156 case 1:
151 return v['new'][ACCUMULATED_SIZE] + 157 return v['new'][ACCUMULATED_SIZE];
152 v['old'][ACCUMULATED_SIZE];
153 case 2: 158 case 2:
154 return v['new'][ACCUMULATED] + 159 return v['new'][ACCUMULATED];
155 v['old'][ACCUMULATED];
156 case 3: 160 case 3:
161 return v['new'][LIVE_AFTER_GC_SIZE] +
162 v['new'][ALLOCATED_SINCE_GC_SIZE];
163 case 4:
164 return v['new'][LIVE_AFTER_GC] +
165 v['new'][ALLOCATED_SINCE_GC];
166 case 5:
157 return v['old'][ACCUMULATED_SIZE]; 167 return v['old'][ACCUMULATED_SIZE];
158 case 4: 168 case 6:
159 return v['old'][ACCUMULATED]; 169 return v['old'][ACCUMULATED];
160 case 5: 170 case 7:
161 return v['new'][LIVE_AFTER_GC_SIZE] + 171 return v['old'][LIVE_AFTER_GC_SIZE] +
162 v['new'][ALLOCATED_SINCE_GC_SIZE] +
163 v['old'][LIVE_AFTER_GC_SIZE] +
164 v['old'][ALLOCATED_SINCE_GC_SIZE]; 172 v['old'][ALLOCATED_SINCE_GC_SIZE];
165 case 6: 173 case 8:
166 return v['new'][LIVE_AFTER_GC] + 174 return v['old'][LIVE_AFTER_GC] +
167 v['new'][ALLOCATED_SINCE_GC] +
168 v['old'][LIVE_AFTER_GC] +
169 v['old'][ALLOCATED_SINCE_GC]; 175 v['old'][ALLOCATED_SINCE_GC];
170 } 176 }
171 throw new FallThroughError(); 177 throw new FallThroughError();
172 } 178 }
173 179
174 void refresh(var done) { 180 void refresh(var done) {
175 if (profile == null) { 181 if (profile == null) {
176 return; 182 return;
177 } 183 }
178 var isolate = profile.isolate; 184 var isolate = profile.isolate;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 249
244 @observable String formattedTotalCollectionTime(bool newSpace) { 250 @observable String formattedTotalCollectionTime(bool newSpace) {
245 if (profile == null) { 251 if (profile == null) {
246 return ''; 252 return '';
247 } 253 }
248 String space = newSpace ? 'new' : 'old'; 254 String space = newSpace ? 'new' : 'old';
249 Map heap = profile['heaps'][space]; 255 Map heap = profile['heaps'][space];
250 return '${Utils.formatSeconds(heap['time'])} secs'; 256 return '${Utils.formatSeconds(heap['time'])} secs';
251 } 257 }
252 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698