| 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 'isolate_element.dart'; | 8 import 'isolate_element.dart'; |
| 9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
| 10 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 /// Displays an IsolateProfile | 56 /// Displays an IsolateProfile |
| 57 @CustomTag('isolate-profile') | 57 @CustomTag('isolate-profile') |
| 58 class IsolateProfileElement extends IsolateElement { | 58 class IsolateProfileElement extends IsolateElement { |
| 59 IsolateProfileElement.created() : super.created(); | 59 IsolateProfileElement.created() : super.created(); |
| 60 @observable int methodCountSelected = 0; | 60 @observable int methodCountSelected = 0; |
| 61 final List methodCounts = [10, 20, 50]; | 61 final List methodCounts = [10, 20, 50]; |
| 62 @observable List topExclusiveCodes = toObservable([]); | 62 @observable List topExclusiveCodes = toObservable([]); |
| 63 final _id = '#tableTree'; | 63 final _id = '#tableTree'; |
| 64 TableTree tree; | 64 TableTree tree; |
| 65 @published Map profile; | 65 @published Map profile; |
| 66 @observable String sampleCount = ''; |
| 67 @observable String refreshTime = ''; |
| 66 | 68 |
| 67 void profileChanged(oldValue) { | 69 void profileChanged(oldValue) { |
| 68 if (profile == null) { | 70 if (profile == null) { |
| 69 return; | 71 return; |
| 70 } | 72 } |
| 71 print('profile changed'); | 73 print('profile changed'); |
| 72 var samples = profile['samples']; | 74 var samples = profile['samples']; |
| 73 _loadProfileData(isolate, samples, profile); | 75 _loadProfileData(isolate, samples, profile); |
| 74 _refresh(isolate); | 76 _refresh(isolate); |
| 75 } | 77 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 assert(profile['type'] == 'Profile'); | 90 assert(profile['type'] == 'Profile'); |
| 89 var samples = profile['samples']; | 91 var samples = profile['samples']; |
| 90 Logger.root.info('Profile contains ${samples} samples.'); | 92 Logger.root.info('Profile contains ${samples} samples.'); |
| 91 _loadProfileData(isolate, samples, profile); | 93 _loadProfileData(isolate, samples, profile); |
| 92 }).catchError((e, st) { | 94 }).catchError((e, st) { |
| 93 Logger.root.warning('Error refreshing profile', e, st); | 95 Logger.root.warning('Error refreshing profile', e, st); |
| 94 }).whenComplete(done); | 96 }).whenComplete(done); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void _loadProfileData(Isolate isolate, int totalSamples, Map response) { | 99 void _loadProfileData(Isolate isolate, int totalSamples, Map response) { |
| 100 sampleCount = totalSamples.toString(); |
| 101 var now = new DateTime.now(); |
| 102 refreshTime = now.toString(); |
| 98 isolate.profile = new Profile.fromMap(isolate, response); | 103 isolate.profile = new Profile.fromMap(isolate, response); |
| 99 _refresh(isolate); | 104 _refresh(isolate); |
| 100 } | 105 } |
| 101 | 106 |
| 102 void _refresh(Isolate isolate) { | 107 void _refresh(Isolate isolate) { |
| 103 _refreshTopMethods(isolate); | 108 _refreshTopMethods(isolate); |
| 104 _refreshTree(isolate); | 109 _refreshTree(isolate); |
| 105 } | 110 } |
| 106 | 111 |
| 107 void _refreshTree(Isolate isolate) { | 112 void _refreshTree(Isolate isolate) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 136 } | 141 } |
| 137 | 142 |
| 138 @observable void toggleExpanded(Event e, var detail, Element target) { | 143 @observable void toggleExpanded(Event e, var detail, Element target) { |
| 139 var row = target.parent; | 144 var row = target.parent; |
| 140 if (row is TableRowElement) { | 145 if (row is TableRowElement) { |
| 141 // Subtract 1 to get 0 based indexing. | 146 // Subtract 1 to get 0 based indexing. |
| 142 tree.toggle(row.rowIndex - 1); | 147 tree.toggle(row.rowIndex - 1); |
| 143 } | 148 } |
| 144 } | 149 } |
| 145 } | 150 } |
| OLD | NEW |