OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'dart:math' as Math; | 7 import 'dart:math' as Math; |
8 import 'package:observatory/models.dart' as M; | 8 import 'package:observatory/models.dart' as M; |
9 import 'package:observatory/src/elements/stack_trace_tree_config.dart' | 9 import 'package:observatory/src/elements/stack_trace_tree_config.dart' |
10 show ProfileTreeMode; | 10 show ProfileTreeMode; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 element.children[5] = new FunctionRefElement( | 198 element.children[5] = new FunctionRefElement( |
199 _isolate, item.profileFunction.function, | 199 _isolate, item.profileFunction.function, |
200 queue: _r.queue) | 200 queue: _r.queue) |
201 ..classes = ['name']; | 201 ..classes = ['name']; |
202 } | 202 } |
203 | 203 |
204 void _updateMemoryFunctionRow( | 204 void _updateMemoryFunctionRow( |
205 HtmlElement element, M.FunctionCallTreeNode item, int depth) { | 205 HtmlElement element, M.FunctionCallTreeNode item, int depth) { |
206 element.children[0].text = | 206 element.children[0].text = |
207 Utils.formatSize(item.inclusiveNativeAllocations); | 207 Utils.formatSize(item.inclusiveNativeAllocations); |
208 element.children[0].title = 'memory allocated from resulting calls: ' + | 208 element.children[0].title = 'memory allocated from resulting calls: ' |
209 '${item.inclusiveNativeAllocations}B'; | 209 '${item.inclusiveNativeAllocations}B'; |
210 element.children[1].text = | 210 element.children[1].text = |
211 Utils.formatSize(item.exclusiveNativeAllocations); | 211 Utils.formatSize(item.exclusiveNativeAllocations); |
212 element.children[1].title = 'memory allocated during execution: ' + | 212 element.children[1].title = 'memory allocated during execution: ' |
213 '${item.exclusiveNativeAllocations}B'; | 213 '${item.exclusiveNativeAllocations}B'; |
214 _updateLines(element.children[2].children, depth); | 214 _updateLines(element.children[2].children, depth); |
215 if (item.children.isNotEmpty) { | 215 if (item.children.isNotEmpty) { |
216 element.children[3].text = | 216 element.children[3].text = |
217 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 217 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
218 } else { | 218 } else { |
219 element.children[3].text = ''; | 219 element.children[3].text = ''; |
220 } | 220 } |
221 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 221 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
222 element.children[5] = new FunctionRefElement( | 222 element.children[5] = new FunctionRefElement( |
(...skipping 18 matching lines...) Expand all Loading... |
241 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 241 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
242 element.children[5] = | 242 element.children[5] = |
243 new CodeRefElement(_isolate, item.profileCode.code, queue: _r.queue) | 243 new CodeRefElement(_isolate, item.profileCode.code, queue: _r.queue) |
244 ..classes = ['name']; | 244 ..classes = ['name']; |
245 } | 245 } |
246 | 246 |
247 void _updateMemoryCodeRow( | 247 void _updateMemoryCodeRow( |
248 HtmlElement element, M.CodeCallTreeNode item, int depth) { | 248 HtmlElement element, M.CodeCallTreeNode item, int depth) { |
249 element.children[0].text = | 249 element.children[0].text = |
250 Utils.formatSize(item.inclusiveNativeAllocations); | 250 Utils.formatSize(item.inclusiveNativeAllocations); |
251 element.children[0].title = 'memory allocated from resulting calls: ' + | 251 element.children[0].title = 'memory allocated from resulting calls: ' |
252 '${item.inclusiveNativeAllocations}B'; | 252 '${item.inclusiveNativeAllocations}B'; |
253 element.children[1].text = | 253 element.children[1].text = |
254 Utils.formatSize(item.exclusiveNativeAllocations); | 254 Utils.formatSize(item.exclusiveNativeAllocations); |
255 element.children[1].title = 'memory allocated during execution: ' + | 255 element.children[1].title = 'memory allocated during execution: ' |
256 '${item.exclusiveNativeAllocations}B'; | 256 '${item.exclusiveNativeAllocations}B'; |
257 _updateLines(element.children[2].children, depth); | 257 _updateLines(element.children[2].children, depth); |
258 if (item.children.isNotEmpty) { | 258 if (item.children.isNotEmpty) { |
259 element.children[3].text = | 259 element.children[3].text = |
260 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 260 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
261 } else { | 261 } else { |
262 element.children[3].text = ''; | 262 element.children[3].text = ''; |
263 } | 263 } |
264 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 264 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
265 element.children[5] = | 265 element.children[5] = |
266 new CodeRefElement(null, item.profileCode.code, queue: _r.queue) | 266 new CodeRefElement(null, item.profileCode.code, queue: _r.queue) |
267 ..classes = ['name']; | 267 ..classes = ['name']; |
268 } | 268 } |
269 | 269 |
270 static _updateLines(List<Element> lines, int n) { | 270 static _updateLines(List<Element> lines, int n) { |
271 n = Math.max(0, n); | 271 n = Math.max(0, n); |
272 while (lines.length > n) { | 272 while (lines.length > n) { |
273 lines.removeLast(); | 273 lines.removeLast(); |
274 } | 274 } |
275 while (lines.length < n) { | 275 while (lines.length < n) { |
276 lines.add(new SpanElement()); | 276 lines.add(new SpanElement()); |
277 } | 277 } |
278 } | 278 } |
279 } | 279 } |
OLD | NEW |