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

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

Issue 3002603002: Remove race condition in Observatory memory page (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 periodically interrogates the VM to log the memory usage of each 7 /// The Element periodically interrogates the VM to log the memory usage of each
8 /// Isolate and of the Native Memory. 8 /// Isolate and of the Native Memory.
9 /// 9 ///
10 /// For each isolate it is shown the Used and Free heap (new and old are merged 10 /// For each isolate it is shown the Used and Free heap (new and old are merged
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 final config = new ChartConfig([sMemory], [0]) 162 final config = new ChartConfig([sMemory], [0])
163 ..legend = new ChartLegend(legend) 163 ..legend = new ChartLegend(legend)
164 ..registerDimensionAxis(0, axisConfig); 164 ..registerDimensionAxis(0, axisConfig);
165 config.minimumSize = new Rect(rect.width, rect.height); 165 config.minimumSize = new Rect(rect.width, rect.height);
166 final data = new ChartData(columns, rows); 166 final data = new ChartData(columns, rows);
167 final state = new ChartState(isMultiSelect: true) 167 final state = new ChartState(isMultiSelect: true)
168 ..changes.listen(_handleEvent); 168 ..changes.listen(_handleEvent);
169 final area = new CartesianArea(host, data, config, state: state) 169 final area = new CartesianArea(host, data, config, state: state)
170 ..theme = theme; 170 ..theme = theme;
171 area.addChartBehavior(new Hovercard(builder: (int column, int row) { 171 area.addChartBehavior(new Hovercard(builder: (int column, int row) {
172 final data = rows[row];
172 if (column == 1) { 173 if (column == 1) {
173 return _formatNativeOvercard(row); 174 return _formatNativeOvercard(data[1]);
174 } 175 }
175 return _formatIsolateOvercard(_seenIsolates[column - 2].id, row); 176 final isolate = _seenIsolates[column - 2];
177 final index = _isolateIndex[isolate.id] * 2 + 2;
178 return _formatIsolateOvercard(isolate.name, data[index], data[index + 1]);
176 })); 179 }));
177 area.draw(); 180 area.draw();
178 181
179 if (_selected != null) { 182 if (_selected != null) {
180 state.select(_selected); 183 state.select(_selected);
181 if (_selected > 1) { 184 if (_selected > 1) {
182 state.select(_selected + 1); 185 state.select(_selected + 1);
183 } 186 }
184 } 187 }
185 } 188 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 final index = _isolateIndex[isolateId]; 318 final index = _isolateIndex[isolateId];
316 final name = _isolateName[isolateId]; 319 final name = _isolateName[isolateId];
317 final free = _isolateFreeSamples.last[index]; 320 final free = _isolateFreeSamples.last[index];
318 final used = _isolateUsedSamples.last[index]; 321 final used = _isolateUsedSamples.last[index];
319 final usedStr = Utils.formatSize(used); 322 final usedStr = Utils.formatSize(used);
320 final capacity = free + used; 323 final capacity = free + used;
321 final capacityStr = Utils.formatSize(capacity); 324 final capacityStr = Utils.formatSize(capacity);
322 return '${name} ($usedStr / $capacityStr)'; 325 return '${name} ($usedStr / $capacityStr)';
323 } 326 }
324 327
325 Element _formatNativeOvercard(int row) => new DivElement() 328 static HtmlElement _formatNativeOvercard(int heap) => new DivElement()
326 ..children = [ 329 ..children = [
327 new DivElement() 330 new DivElement()
328 ..classes = ['hovercard-title'] 331 ..classes = ['hovercard-title']
329 ..text = 'Native', 332 ..text = 'Native',
330 new DivElement() 333 new DivElement()
331 ..classes = ['hovercard-measure', 'hovercard-multi'] 334 ..classes = ['hovercard-measure', 'hovercard-multi']
332 ..children = [ 335 ..children = [
333 new DivElement() 336 new DivElement()
334 ..classes = ['hovercard-measure-label'] 337 ..classes = ['hovercard-measure-label']
335 ..text = 'Heap', 338 ..text = 'Heap',
336 new DivElement() 339 new DivElement()
337 ..classes = ['hovercard-measure-value'] 340 ..classes = ['hovercard-measure-value']
338 ..text = Utils.formatSize(_vmSamples[row]), 341 ..text = Utils.formatSize(heap),
339 ] 342 ]
340 ]; 343 ];
341 344
342 Element _formatIsolateOvercard(String isolateId, int row) { 345 static HtmlElement _formatIsolateOvercard(String name, int free, int used) {
343 final index = _isolateIndex[isolateId];
344 final free = _isolateFreeSamples[row][index];
345 final used = _isolateUsedSamples[row][index];
346 final capacity = free + used; 346 final capacity = free + used;
347 return new DivElement() 347 return new DivElement()
348 ..children = [ 348 ..children = [
349 new DivElement() 349 new DivElement()
350 ..classes = ['hovercard-title'] 350 ..classes = ['hovercard-title']
351 ..text = _isolateName[isolateId], 351 ..text = name,
352 new DivElement() 352 new DivElement()
353 ..classes = ['hovercard-measure', 'hovercard-multi'] 353 ..classes = ['hovercard-measure', 'hovercard-multi']
354 ..children = [ 354 ..children = [
355 new DivElement() 355 new DivElement()
356 ..classes = ['hovercard-measure-label'] 356 ..classes = ['hovercard-measure-label']
357 ..text = 'Heap Capacity', 357 ..text = 'Heap Capacity',
358 new DivElement() 358 new DivElement()
359 ..classes = ['hovercard-measure-value'] 359 ..classes = ['hovercard-measure-value']
360 ..text = Utils.formatSize(capacity), 360 ..text = Utils.formatSize(capacity),
361 ], 361 ],
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 </defs> 427 </defs>
428 '''; 428 ''';
429 429
430 StyleElement get style => new StyleElement() 430 StyleElement get style => new StyleElement()
431 ..text = ''' 431 ..text = '''
432 memory-graph svg .stacked-line-rdr-line:nth-child(2n+${_offset+1}) 432 memory-graph svg .stacked-line-rdr-line:nth-child(2n+${_offset+1})
433 path:nth-child(1) { 433 path:nth-child(1) {
434 filter: url(#stroke-grid); 434 filter: url(#stroke-grid);
435 }'''; 435 }''';
436 } 436 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698