| 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 library cpu_profile_table_element; | 5 library cpu_profile_table_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
| 10 import 'package:observatory/src/elements/containers/virtual_collection.dart'; | 10 import 'package:observatory/src/elements/containers/virtual_collection.dart'; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 void _updateFunction(Element e, M.ProfileFunction item, int index) { | 219 void _updateFunction(Element e, M.ProfileFunction item, int index) { |
| 220 if (item == _selected) { | 220 if (item == _selected) { |
| 221 e.classes = ['function-item', 'selected']; | 221 e.classes = ['function-item', 'selected']; |
| 222 } else { | 222 } else { |
| 223 e.classes = ['function-item']; | 223 e.classes = ['function-item']; |
| 224 } | 224 } |
| 225 e.children[0].text = Utils.formatPercentNormalized(_getExclusiveT(item)); | 225 e.children[0].text = Utils.formatPercentNormalized(_getExclusiveT(item)); |
| 226 e.children[1].text = Utils.formatPercentNormalized(_getInclusiveT(item)); | 226 e.children[1].text = Utils.formatPercentNormalized(_getInclusiveT(item)); |
| 227 e.children[2] = new FunctionRefElement(_isolate, item.function, | 227 e.children[2] = |
| 228 queue: _r.queue)..classes = ['name']; | 228 new FunctionRefElement(_isolate, item.function, queue: _r.queue) |
| 229 ..classes = ['name']; |
| 229 } | 230 } |
| 230 | 231 |
| 231 Element _createFunctionHeader() => new DivElement() | 232 Element _createFunctionHeader() => new DivElement() |
| 232 ..classes = ['function-item'] | 233 ..classes = ['function-item'] |
| 233 ..children = [ | 234 ..children = [ |
| 234 _createHeaderButton(const ['exclusive'], 'Execution(%)', _Table.functions, | 235 _createHeaderButton(const ['exclusive'], 'Execution(%)', _Table.functions, |
| 235 _SortingField.exclusive, _SortingDirection.descending), | 236 _SortingField.exclusive, _SortingDirection.descending), |
| 236 _createHeaderButton(const ['inclusive'], 'Stack(%)', _Table.functions, | 237 _createHeaderButton(const ['inclusive'], 'Stack(%)', _Table.functions, |
| 237 _SortingField.inclusive, _SortingDirection.descending), | 238 _SortingField.inclusive, _SortingDirection.descending), |
| 238 _createHeaderButton(const ['name'], 'Method', _Table.functions, | 239 _createHeaderButton(const ['name'], 'Method', _Table.functions, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return; | 272 return; |
| 272 } | 273 } |
| 273 _selected = _callees.getItemFromElement(element); | 274 _selected = _callees.getItemFromElement(element); |
| 274 _r.dirty(); | 275 _r.dirty(); |
| 275 }); | 276 }); |
| 276 return element; | 277 return element; |
| 277 } | 278 } |
| 278 | 279 |
| 279 void _updateCallee(Element e, item, int index) { | 280 void _updateCallee(Element e, item, int index) { |
| 280 e.children[0].text = Utils.formatPercentNormalized(_getCalleeT(item)); | 281 e.children[0].text = Utils.formatPercentNormalized(_getCalleeT(item)); |
| 281 e.children[1] = new FunctionRefElement(_isolate, item.function, | 282 e.children[1] = |
| 282 queue: _r.queue)..classes = ['name']; | 283 new FunctionRefElement(_isolate, item.function, queue: _r.queue) |
| 284 ..classes = ['name']; |
| 283 } | 285 } |
| 284 | 286 |
| 285 Element _createCalleeHeader() => new DivElement() | 287 Element _createCalleeHeader() => new DivElement() |
| 286 ..classes = ['function-item'] | 288 ..classes = ['function-item'] |
| 287 ..children = [ | 289 ..children = [ |
| 288 _createHeaderButton(const ['inclusive'], 'Callees(%)', _Table.callee, | 290 _createHeaderButton(const ['inclusive'], 'Callees(%)', _Table.callee, |
| 289 _SortingField.callee, _SortingDirection.descending), | 291 _SortingField.callee, _SortingDirection.descending), |
| 290 _createHeaderButton(const ['name'], 'Method', _Table.callee, | 292 _createHeaderButton(const ['name'], 'Method', _Table.callee, |
| 291 _SortingField.method, _SortingDirection.ascending), | 293 _SortingField.method, _SortingDirection.ascending), |
| 292 ]; | 294 ]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 305 return; | 307 return; |
| 306 } | 308 } |
| 307 _selected = _callers.getItemFromElement(element); | 309 _selected = _callers.getItemFromElement(element); |
| 308 _r.dirty(); | 310 _r.dirty(); |
| 309 }); | 311 }); |
| 310 return element; | 312 return element; |
| 311 } | 313 } |
| 312 | 314 |
| 313 void _updateCaller(Element e, item, int index) { | 315 void _updateCaller(Element e, item, int index) { |
| 314 e.children[0].text = Utils.formatPercentNormalized(_getCallerT(item)); | 316 e.children[0].text = Utils.formatPercentNormalized(_getCallerT(item)); |
| 315 e.children[1] = new FunctionRefElement(_isolate, item.function, | 317 e.children[1] = |
| 316 queue: _r.queue)..classes = ['name']; | 318 new FunctionRefElement(_isolate, item.function, queue: _r.queue) |
| 319 ..classes = ['name']; |
| 317 } | 320 } |
| 318 | 321 |
| 319 Element _createCallerHeader() => new DivElement() | 322 Element _createCallerHeader() => new DivElement() |
| 320 ..classes = ['function-item'] | 323 ..classes = ['function-item'] |
| 321 ..children = [ | 324 ..children = [ |
| 322 _createHeaderButton(const ['inclusive'], 'Callers(%)', _Table.caller, | 325 _createHeaderButton(const ['inclusive'], 'Callers(%)', _Table.caller, |
| 323 _SortingField.caller, _SortingDirection.descending), | 326 _SortingField.caller, _SortingDirection.descending), |
| 324 _createHeaderButton(const ['name'], 'Method', _Table.caller, | 327 _createHeaderButton(const ['name'], 'Method', _Table.caller, |
| 325 _SortingField.method, _SortingDirection.ascending), | 328 _SortingField.method, _SortingDirection.ascending), |
| 326 ]; | 329 ]; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 433 |
| 431 static double _getExclusiveT(M.ProfileFunction f) => | 434 static double _getExclusiveT(M.ProfileFunction f) => |
| 432 f.normalizedExclusiveTicks; | 435 f.normalizedExclusiveTicks; |
| 433 static double _getInclusiveT(M.ProfileFunction f) => | 436 static double _getInclusiveT(M.ProfileFunction f) => |
| 434 f.normalizedInclusiveTicks; | 437 f.normalizedInclusiveTicks; |
| 435 double _getCalleeT(M.ProfileFunction f) => | 438 double _getCalleeT(M.ProfileFunction f) => |
| 436 _selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b); | 439 _selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b); |
| 437 double _getCallerT(M.ProfileFunction f) => | 440 double _getCallerT(M.ProfileFunction f) => |
| 438 _selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b); | 441 _selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b); |
| 439 } | 442 } |
| OLD | NEW |