| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 Element _createFunction() { | 216 Element _createFunction() { |
| 217 final element = new DivElement() | 217 final element = new DivElement() |
| 218 ..classes = const ['function-item'] | 218 ..classes = const ['function-item'] |
| 219 ..children = [ | 219 ..children = [ |
| 220 new SpanElement()..classes = const ['exclusive'] | 220 new SpanElement()..classes = const ['exclusive'] |
| 221 ..text = '0%', | 221 ..text = '0%', |
| 222 new SpanElement()..classes = const ['inclusive'] | 222 new SpanElement()..classes = const ['inclusive'] |
| 223 ..text = '0%', | 223 ..text = '0%', |
| 224 new SpanElement()..classes = const ['name'] | 224 new SpanElement()..classes = const ['name'] |
| 225 ]; | 225 ]; |
| 226 element.onClick.listen((_) { | 226 element.onClick.listen((e) { |
| 227 if (e.target is AnchorElement) { |
| 228 return; |
| 229 } |
| 227 _selected = _functions.getItemFromElement(element); | 230 _selected = _functions.getItemFromElement(element); |
| 228 _r.dirty(); | 231 _r.dirty(); |
| 229 }); | 232 }); |
| 230 return element; | 233 return element; |
| 231 } | 234 } |
| 232 | 235 |
| 233 void _updateFunction(Element e, M.ProfileFunction item, int index) { | 236 void _updateFunction(Element e, M.ProfileFunction item, int index) { |
| 234 if (item == _selected) { | 237 if (item == _selected) { |
| 235 e.classes = const ['function-item', 'selected']; | 238 e.classes = const ['function-item', 'selected']; |
| 236 } else { | 239 } else { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 283 } |
| 281 | 284 |
| 282 Element _createCallee() { | 285 Element _createCallee() { |
| 283 final element = new DivElement() | 286 final element = new DivElement() |
| 284 ..classes = const ['function-item'] | 287 ..classes = const ['function-item'] |
| 285 ..children = [ | 288 ..children = [ |
| 286 new SpanElement()..classes = const ['inclusive'] | 289 new SpanElement()..classes = const ['inclusive'] |
| 287 ..text = '0%', | 290 ..text = '0%', |
| 288 new SpanElement()..classes = const ['name'] | 291 new SpanElement()..classes = const ['name'] |
| 289 ]; | 292 ]; |
| 290 element.onClick.listen((_) { | 293 element.onClick.listen((e) { |
| 294 if (e.target is AnchorElement) { |
| 295 return; |
| 296 } |
| 291 _selected = _callees.getItemFromElement(element); | 297 _selected = _callees.getItemFromElement(element); |
| 292 _r.dirty(); | 298 _r.dirty(); |
| 293 }); | 299 }); |
| 294 return element; | 300 return element; |
| 295 } | 301 } |
| 296 | 302 |
| 297 void _updateCallee(Element e, item, int index) { | 303 void _updateCallee(Element e, item, int index) { |
| 298 e.children[0].text = Utils.formatPercentNormalized(_getCalleeT(item)); | 304 e.children[0].text = Utils.formatPercentNormalized(_getCalleeT(item)); |
| 299 e.children[1] = new FunctionRefElement(_isolate, item.function, | 305 e.children[1] = new FunctionRefElement(_isolate, item.function, |
| 300 queue: _r.queue)..classes = const ['name']; | 306 queue: _r.queue)..classes = const ['name']; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 315 ]; | 321 ]; |
| 316 | 322 |
| 317 Element _createCaller() { | 323 Element _createCaller() { |
| 318 final element = new DivElement() | 324 final element = new DivElement() |
| 319 ..classes = const ['function-item'] | 325 ..classes = const ['function-item'] |
| 320 ..children = [ | 326 ..children = [ |
| 321 new SpanElement()..classes = const ['inclusive'] | 327 new SpanElement()..classes = const ['inclusive'] |
| 322 ..text = '0%', | 328 ..text = '0%', |
| 323 new SpanElement()..classes = const ['name'] | 329 new SpanElement()..classes = const ['name'] |
| 324 ]; | 330 ]; |
| 325 element.onClick.listen((_) { | 331 element.onClick.listen((e) { |
| 332 if (e.target is AnchorElement) { |
| 333 return; |
| 334 } |
| 326 _selected = _callers.getItemFromElement(element); | 335 _selected = _callers.getItemFromElement(element); |
| 327 _r.dirty(); | 336 _r.dirty(); |
| 328 }); | 337 }); |
| 329 return element; | 338 return element; |
| 330 } | 339 } |
| 331 | 340 |
| 332 void _updateCaller(Element e, item, int index) { | 341 void _updateCaller(Element e, item, int index) { |
| 333 e.children[0].text = Utils.formatPercentNormalized(_getCallerT(item)); | 342 e.children[0].text = Utils.formatPercentNormalized(_getCallerT(item)); |
| 334 e.children[1] = new FunctionRefElement(_isolate, item.function, | 343 e.children[1] = new FunctionRefElement(_isolate, item.function, |
| 335 queue: _r.queue)..classes = const ['name']; | 344 queue: _r.queue)..classes = const ['name']; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 451 |
| 443 static double _getExclusiveT(M.ProfileFunction f) => | 452 static double _getExclusiveT(M.ProfileFunction f) => |
| 444 f.normalizedExclusiveTicks; | 453 f.normalizedExclusiveTicks; |
| 445 static double _getInclusiveT(M.ProfileFunction f) => | 454 static double _getInclusiveT(M.ProfileFunction f) => |
| 446 f.normalizedInclusiveTicks; | 455 f.normalizedInclusiveTicks; |
| 447 double _getCalleeT(M.ProfileFunction f) => | 456 double _getCalleeT(M.ProfileFunction f) => |
| 448 _selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b); | 457 _selected.callees[f] / _selected.callees.values.reduce((a, b) => a + b); |
| 449 double _getCallerT(M.ProfileFunction f) => | 458 double _getCallerT(M.ProfileFunction f) => |
| 450 _selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b); | 459 _selected.callers[f] / _selected.callers.values.reduce((a, b) => a + b); |
| 451 } | 460 } |
| OLD | NEW |