| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 .formatPercentNormalized(item.profileFunction.normalizedExclusiveTicks); | 189 .formatPercentNormalized(item.profileFunction.normalizedExclusiveTicks); |
| 190 _updateLines(element.children[2].children, depth); | 190 _updateLines(element.children[2].children, depth); |
| 191 if (item.children.isNotEmpty) { | 191 if (item.children.isNotEmpty) { |
| 192 element.children[3].text = | 192 element.children[3].text = |
| 193 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 193 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
| 194 } else { | 194 } else { |
| 195 element.children[3].text = ''; | 195 element.children[3].text = ''; |
| 196 } | 196 } |
| 197 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 197 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
| 198 element.children[5] = new FunctionRefElement( | 198 element.children[5] = new FunctionRefElement( |
| 199 _isolate, item.profileFunction.function, queue: _r.queue) | 199 _isolate, item.profileFunction.function, |
| 200 queue: _r.queue) |
| 200 ..classes = ['name']; | 201 ..classes = ['name']; |
| 201 } | 202 } |
| 202 | 203 |
| 203 void _updateMemoryFunctionRow( | 204 void _updateMemoryFunctionRow( |
| 204 HtmlElement element, M.FunctionCallTreeNode item, int depth) { | 205 HtmlElement element, M.FunctionCallTreeNode item, int depth) { |
| 205 element.children[0].text = | 206 element.children[0].text = |
| 206 Utils.formatSize(item.inclusiveNativeAllocations); | 207 Utils.formatSize(item.inclusiveNativeAllocations); |
| 207 element.children[0].title = 'memory allocated from resulting calls: ' + | 208 element.children[0].title = 'memory allocated from resulting calls: ' + |
| 208 '${item.inclusiveNativeAllocations}B'; | 209 '${item.inclusiveNativeAllocations}B'; |
| 209 element.children[1].text = | 210 element.children[1].text = |
| 210 Utils.formatSize(item.exclusiveNativeAllocations); | 211 Utils.formatSize(item.exclusiveNativeAllocations); |
| 211 element.children[1].title = 'memory allocated during execution: ' + | 212 element.children[1].title = 'memory allocated during execution: ' + |
| 212 '${item.exclusiveNativeAllocations}B'; | 213 '${item.exclusiveNativeAllocations}B'; |
| 213 _updateLines(element.children[2].children, depth); | 214 _updateLines(element.children[2].children, depth); |
| 214 if (item.children.isNotEmpty) { | 215 if (item.children.isNotEmpty) { |
| 215 element.children[3].text = | 216 element.children[3].text = |
| 216 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 217 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
| 217 } else { | 218 } else { |
| 218 element.children[3].text = ''; | 219 element.children[3].text = ''; |
| 219 } | 220 } |
| 220 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 221 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
| 221 element.children[5] = new FunctionRefElement( | 222 element.children[5] = new FunctionRefElement( |
| 222 null, item.profileFunction.function, queue: _r.queue) | 223 null, item.profileFunction.function, |
| 224 queue: _r.queue) |
| 223 ..classes = ['name']; | 225 ..classes = ['name']; |
| 224 } | 226 } |
| 225 | 227 |
| 226 void _updateCpuCodeRow( | 228 void _updateCpuCodeRow( |
| 227 HtmlElement element, M.CodeCallTreeNode item, int depth) { | 229 HtmlElement element, M.CodeCallTreeNode item, int depth) { |
| 228 element.children[0].text = Utils | 230 element.children[0].text = Utils |
| 229 .formatPercentNormalized(item.profileCode.normalizedInclusiveTicks); | 231 .formatPercentNormalized(item.profileCode.normalizedInclusiveTicks); |
| 230 element.children[1].text = Utils | 232 element.children[1].text = Utils |
| 231 .formatPercentNormalized(item.profileCode.normalizedExclusiveTicks); | 233 .formatPercentNormalized(item.profileCode.normalizedExclusiveTicks); |
| 232 _updateLines(element.children[2].children, depth); | 234 _updateLines(element.children[2].children, depth); |
| 233 if (item.children.isNotEmpty) { | 235 if (item.children.isNotEmpty) { |
| 234 element.children[3].text = | 236 element.children[3].text = |
| 235 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 237 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
| 236 } else { | 238 } else { |
| 237 element.children[3].text = ''; | 239 element.children[3].text = ''; |
| 238 } | 240 } |
| 239 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 241 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
| 240 element.children[5] = new CodeRefElement(_isolate, item.profileCode.code, | 242 element.children[5] = |
| 241 queue: _r.queue)..classes = ['name']; | 243 new CodeRefElement(_isolate, item.profileCode.code, queue: _r.queue) |
| 244 ..classes = ['name']; |
| 242 } | 245 } |
| 243 | 246 |
| 244 void _updateMemoryCodeRow( | 247 void _updateMemoryCodeRow( |
| 245 HtmlElement element, M.CodeCallTreeNode item, int depth) { | 248 HtmlElement element, M.CodeCallTreeNode item, int depth) { |
| 246 element.children[0].text = | 249 element.children[0].text = |
| 247 Utils.formatSize(item.inclusiveNativeAllocations); | 250 Utils.formatSize(item.inclusiveNativeAllocations); |
| 248 element.children[0].title = 'memory allocated from resulting calls: ' + | 251 element.children[0].title = 'memory allocated from resulting calls: ' + |
| 249 '${item.inclusiveNativeAllocations}B'; | 252 '${item.inclusiveNativeAllocations}B'; |
| 250 element.children[1].text = | 253 element.children[1].text = |
| 251 Utils.formatSize(item.exclusiveNativeAllocations); | 254 Utils.formatSize(item.exclusiveNativeAllocations); |
| 252 element.children[1].title = 'memory allocated during execution: ' + | 255 element.children[1].title = 'memory allocated during execution: ' + |
| 253 '${item.exclusiveNativeAllocations}B'; | 256 '${item.exclusiveNativeAllocations}B'; |
| 254 _updateLines(element.children[2].children, depth); | 257 _updateLines(element.children[2].children, depth); |
| 255 if (item.children.isNotEmpty) { | 258 if (item.children.isNotEmpty) { |
| 256 element.children[3].text = | 259 element.children[3].text = |
| 257 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; | 260 _tree.isExpanded(item) ? _expandedIcon : _collapsedIcon; |
| 258 } else { | 261 } else { |
| 259 element.children[3].text = ''; | 262 element.children[3].text = ''; |
| 260 } | 263 } |
| 261 element.children[4].text = Utils.formatPercentNormalized(item.percentage); | 264 element.children[4].text = Utils.formatPercentNormalized(item.percentage); |
| 262 element.children[5] = new CodeRefElement(null, item.profileCode.code, | 265 element.children[5] = |
| 263 queue: _r.queue)..classes = ['name']; | 266 new CodeRefElement(null, item.profileCode.code, queue: _r.queue) |
| 267 ..classes = ['name']; |
| 264 } | 268 } |
| 265 | 269 |
| 266 static _updateLines(List<Element> lines, int n) { | 270 static _updateLines(List<Element> lines, int n) { |
| 267 n = Math.max(0, n); | 271 n = Math.max(0, n); |
| 268 while (lines.length > n) { | 272 while (lines.length > n) { |
| 269 lines.removeLast(); | 273 lines.removeLast(); |
| 270 } | 274 } |
| 271 while (lines.length < n) { | 275 while (lines.length < n) { |
| 272 lines.add(new SpanElement()); | 276 lines.add(new SpanElement()); |
| 273 } | 277 } |
| 274 } | 278 } |
| 275 } | 279 } |
| OLD | NEW |