| 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 isolate_profile_element; | 5 library isolate_profile_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
| 9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
| 10 import 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return '${percent.toStringAsFixed(2)}%'; | 70 return '${percent.toStringAsFixed(2)}%'; |
| 71 } | 71 } |
| 72 | 72 |
| 73 ProfileCallerTreeRow(this.profile, this.code, ProfileCallerTreeRow parent) : | 73 ProfileCallerTreeRow(this.profile, this.code, ProfileCallerTreeRow parent) : |
| 74 super(parent) { | 74 super(parent) { |
| 75 assert(profile != null); | 75 assert(profile != null); |
| 76 assert(code != null); | 76 assert(code != null); |
| 77 var totalSamples = profile['samples']; | 77 var totalSamples = profile['samples']; |
| 78 // When the row is created, fill out the columns. | 78 // When the row is created, fill out the columns. |
| 79 if (parent == null) { | 79 if (parent == null) { |
| 80 var root = profile.isolate.codes.tagRoot(); | 80 var root = profile.isolate.tagRoot(); |
| 81 var totalAttributedCalls = root.callersCount(code); | 81 var totalAttributedCalls = root.callersCount(code); |
| 82 var totalParentCalls = root.sumCallersCount(); | 82 var totalParentCalls = root.sumCallersCount(); |
| 83 columns.add(formatPercent(totalAttributedCalls, totalParentCalls)); | 83 columns.add(formatPercent(totalAttributedCalls, totalParentCalls)); |
| 84 } else { | 84 } else { |
| 85 var totalAttributedCalls = parent.code.callersCount(code); | 85 var totalAttributedCalls = parent.code.callersCount(code); |
| 86 var totalParentCalls = parent.code.sumCallersCount(); | 86 var totalParentCalls = parent.code.sumCallersCount(); |
| 87 columns.add(formatPercent(totalAttributedCalls, totalParentCalls)); | 87 columns.add(formatPercent(totalAttributedCalls, totalParentCalls)); |
| 88 } | 88 } |
| 89 columns.add(formatPercent(code.exclusiveTicks, totalSamples)); | 89 columns.add(formatPercent(code.exclusiveTicks, totalSamples)); |
| 90 } | 90 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 void _update() { | 182 void _update() { |
| 183 if (profile == null) { | 183 if (profile == null) { |
| 184 return; | 184 return; |
| 185 } | 185 } |
| 186 _buildTree(); | 186 _buildTree(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void _buildCallersTree() { | 189 void _buildCallersTree() { |
| 190 assert(profile != null); | 190 assert(profile != null); |
| 191 var root = profile.isolate.codes.tagRoot(); | 191 var root = profile.isolate.tagRoot(); |
| 192 if (root == null) { | 192 if (root == null) { |
| 193 Logger.root.warning('No profile root tag.'); | 193 Logger.root.warning('No profile root tag.'); |
| 194 } | 194 } |
| 195 try { | 195 try { |
| 196 tree.initialize(new ProfileCallerTreeRow(profile, root, null)); | 196 tree.initialize(new ProfileCallerTreeRow(profile, root, null)); |
| 197 } catch (e, stackTrace) { | 197 } catch (e, stackTrace) { |
| 198 Logger.root.warning('_buildCallersTree', e, stackTrace); | 198 Logger.root.warning('_buildCallersTree', e, stackTrace); |
| 199 } | 199 } |
| 200 | 200 |
| 201 notifyPropertyChange(#tree, null, tree); | 201 notifyPropertyChange(#tree, null, tree); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 @observable void toggleExpanded(Event e, var detail, Element target) { | 236 @observable void toggleExpanded(Event e, var detail, Element target) { |
| 237 var row = target.parent; | 237 var row = target.parent; |
| 238 if (row is TableRowElement) { | 238 if (row is TableRowElement) { |
| 239 // Subtract 1 to get 0 based indexing. | 239 // Subtract 1 to get 0 based indexing. |
| 240 tree.toggle(row.rowIndex - 1); | 240 tree.toggle(row.rowIndex - 1); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 } | 244 } |
| OLD | NEW |