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

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

Issue 3003903002: Hide internal classes from Memory Profile (Closed)
Patch Set: Address CL comments Created 3 years, 3 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /// This Element is part of MemoryDashboardElement. 5 /// This Element is part of MemoryDashboardElement.
6 /// 6 ///
7 /// The Element is stripped down version of AllocationProfileElement where 7 /// The Element is stripped down version of AllocationProfileElement where
8 /// concepts like old and new space has been hidden away. 8 /// concepts like old and new space has been hidden away.
9 /// 9 ///
10 /// For each class in the system it is shown the Total number of instances 10 /// For each class in the system it is shown the Total number of instances
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 children = [ 102 children = [
103 new DivElement() 103 new DivElement()
104 ..classes = ['content-centered-big'] 104 ..classes = ['content-centered-big']
105 ..children = [new HeadingElement.h2()..text = 'Loading...'] 105 ..children = [new HeadingElement.h2()..text = 'Loading...']
106 ]; 106 ];
107 } else { 107 } else {
108 children = [ 108 children = [
109 new VirtualCollectionElement( 109 new VirtualCollectionElement(
110 _createCollectionLine, _updateCollectionLine, 110 _createCollectionLine, _updateCollectionLine,
111 createHeader: _createCollectionHeader, 111 createHeader: _createCollectionHeader,
112 items: _profile.members.toList()..sort(_createSorter()), 112 items: _profile.members
113 .where((member) =>
114 member.newSpace.accumulated.instances != 0 ||
115 member.newSpace.current.instances != 0 ||
116 member.oldSpace.accumulated.instances != 0 ||
117 member.oldSpace.current.instances != 0)
118 .toList()
119 ..sort(_createSorter()),
113 queue: _r.queue) 120 queue: _r.queue)
114 ]; 121 ];
115 } 122 }
116 } 123 }
117 124
118 _createSorter() { 125 _createSorter() {
119 var getter; 126 var getter;
120 switch (_sortingField) { 127 switch (_sortingField) {
121 case _SortingField.accumulatedSize: 128 case _SortingField.accumulatedSize:
122 getter = _getAccumulatedSize; 129 getter = _getAccumulatedSize;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 _sortingField = field; 233 _sortingField = field;
227 } 234 }
228 _r.dirty(); 235 _r.dirty();
229 } 236 }
230 237
231 void _updateCollectionLine(Element e, M.ClassHeapStats item, index) { 238 void _updateCollectionLine(Element e, M.ClassHeapStats item, index) {
232 e.children[0].text = Utils.formatSize(_getAccumulatedSize(item)); 239 e.children[0].text = Utils.formatSize(_getAccumulatedSize(item));
233 e.children[1].text = '${_getAccumulatedInstances(item)}'; 240 e.children[1].text = '${_getAccumulatedInstances(item)}';
234 e.children[2].text = Utils.formatSize(_getCurrentSize(item)); 241 e.children[2].text = Utils.formatSize(_getCurrentSize(item));
235 e.children[3].text = '${_getCurrentInstances(item)}'; 242 e.children[3].text = '${_getCurrentInstances(item)}';
243 if (item.clazz == null) {
244 e.children[4] = new SpanElement()
245 ..text = item.displayName
246 ..classes = ['name'];
247 return;
248 }
236 e.children[4] = new ClassRefElement(_isolate, item.clazz, queue: _r.queue) 249 e.children[4] = new ClassRefElement(_isolate, item.clazz, queue: _r.queue)
237 ..classes = ['name']; 250 ..classes = ['name'];
238 Element.clickEvent.forTarget(e.children[4], useCapture: true).listen((e) { 251 Element.clickEvent.forTarget(e.children[4], useCapture: true).listen((e) {
239 if (_editor.isAvailable) { 252 if (_editor.isAvailable) {
240 e.preventDefault(); 253 e.preventDefault();
241 _editor.openClass(isolate, item.clazz); 254 _editor.openClass(isolate, item.clazz);
242 } 255 }
243 }); 256 });
244 } 257 }
245 258
246 Future _refresh({bool gc: false, bool reset: false}) async { 259 Future _refresh({bool gc: false, bool reset: false}) async {
247 _profile = null; 260 _profile = null;
248 _r.dirty(); 261 _r.dirty();
249 _profile = await _repository.get(_isolate, gc: gc, reset: reset); 262 _profile =
263 await _repository.get(_isolate, gc: gc, reset: reset, combine: true);
250 _r.dirty(); 264 _r.dirty();
251 } 265 }
252 266
253 static int _getAccumulatedSize(M.ClassHeapStats s) => 267 static int _getAccumulatedSize(M.ClassHeapStats s) =>
254 s.newSpace.accumulated.bytes + s.oldSpace.accumulated.bytes; 268 s.newSpace.accumulated.bytes + s.oldSpace.accumulated.bytes;
255 static int _getAccumulatedInstances(M.ClassHeapStats s) => 269 static int _getAccumulatedInstances(M.ClassHeapStats s) =>
256 s.newSpace.accumulated.instances + s.oldSpace.accumulated.instances; 270 s.newSpace.accumulated.instances + s.oldSpace.accumulated.instances;
257 static int _getCurrentSize(M.ClassHeapStats s) => 271 static int _getCurrentSize(M.ClassHeapStats s) =>
258 s.newSpace.current.bytes + s.oldSpace.current.bytes; 272 s.newSpace.current.bytes + s.oldSpace.current.bytes;
259 static int _getCurrentInstances(M.ClassHeapStats s) => 273 static int _getCurrentInstances(M.ClassHeapStats s) =>
260 s.newSpace.current.instances + s.oldSpace.current.instances; 274 s.newSpace.current.instances + s.oldSpace.current.instances;
261 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698