| Index: runtime/bin/vmservice/client/lib/src/elements/isolate_profile.dart
|
| diff --git a/runtime/bin/vmservice/client/lib/src/observatory_elements/isolate_profile.dart b/runtime/bin/vmservice/client/lib/src/elements/isolate_profile.dart
|
| similarity index 78%
|
| rename from runtime/bin/vmservice/client/lib/src/observatory_elements/isolate_profile.dart
|
| rename to runtime/bin/vmservice/client/lib/src/elements/isolate_profile.dart
|
| index eff6f8de7bd6d411ac424fb4c660b8ff807acd2d..50f4f3f1be97ade49682a2901de0a4fb81ded838 100644
|
| --- a/runtime/bin/vmservice/client/lib/src/observatory_elements/isolate_profile.dart
|
| +++ b/runtime/bin/vmservice/client/lib/src/elements/isolate_profile.dart
|
| @@ -5,10 +5,10 @@
|
| library isolate_profile_element;
|
|
|
| import 'dart:html';
|
| +import 'isolate_element.dart';
|
| import 'package:logging/logging.dart';
|
| -import 'package:observatory/observatory.dart';
|
| +import 'package:observatory/app.dart';
|
| import 'package:polymer/polymer.dart';
|
| -import 'observatory_element.dart';
|
|
|
| class ProfileCallerTreeRow extends TableTreeRow {
|
| final Isolate isolate;
|
| @@ -55,58 +55,42 @@ class ProfileCallerTreeRow extends TableTreeRow {
|
|
|
| /// Displays an IsolateProfile
|
| @CustomTag('isolate-profile')
|
| -class IsolateProfileElement extends ObservatoryElement {
|
| +class IsolateProfileElement extends IsolateElement {
|
| IsolateProfileElement.created() : super.created();
|
| @observable int methodCountSelected = 0;
|
| final List methodCounts = [10, 20, 50];
|
| @observable List topExclusiveCodes = toObservable([]);
|
| final _id = '#tableTree';
|
| TableTree tree;
|
| + @published Map profile;
|
|
|
| - void enteredView() {
|
| - var isolateId = app.locationManager.currentIsolateId();
|
| - var isolate = app.isolateManager.getIsolate(isolateId);
|
| - if (isolate == null) {
|
| + void profileChanged(oldValue) {
|
| + if (profile == null) {
|
| return;
|
| }
|
| - tree = new TableTree(['Method', 'Exclusive', 'Caller', 'Inclusive']);
|
| + print('profile changed');
|
| + var samples = profile['samples'];
|
| + _loadProfileData(isolate, samples, profile);
|
| _refresh(isolate);
|
| }
|
|
|
| - void _startRequest() {
|
| - // TODO(johnmccutchan): Indicate visually.
|
| - }
|
| -
|
| - void _endRequest() {
|
| - // TODO(johnmccutchan): Indicate visually.
|
| + void enteredView() {
|
| + tree = new TableTree(['Method', 'Exclusive', 'Caller', 'Inclusive']);
|
| + _refresh(isolate);
|
| }
|
|
|
| methodCountSelectedChanged(oldValue) {
|
| - var isolateId = app.locationManager.currentIsolateId();
|
| - var isolate = app.isolateManager.getIsolate(isolateId);
|
| - if (isolate == null) {
|
| - return;
|
| - }
|
| _refresh(isolate);
|
| }
|
|
|
| void refresh(var done) {
|
| - var isolateId = app.locationManager.currentIsolateId();
|
| - var isolate = app.isolateManager.getIsolate(isolateId);
|
| - if (isolate == null) {
|
| - Logger.root.info('No isolate found.');
|
| - return;
|
| - }
|
| - var request = '/$isolateId/profile';
|
| - _startRequest();
|
| - app.requestManager.requestMap(request).then((Map profile) {
|
| + isolate.getMap('profile').then((Map profile) {
|
| assert(profile['type'] == 'Profile');
|
| var samples = profile['samples'];
|
| Logger.root.info('Profile contains ${samples} samples.');
|
| _loadProfileData(isolate, samples, profile);
|
| - _endRequest();
|
| - }).catchError((e) {
|
| - _endRequest();
|
| + }).catchError((e, st) {
|
| + Logger.root.warning('Error refreshing profile', e, st);
|
| }).whenComplete(done);
|
| }
|
|
|
|
|