| Index: runtime/observatory/lib/src/elements/cpu_profile.dart
|
| diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
|
| index 44b9e0baffffe67c5b24670a1172a5504f1ad142..154f80fee98b6c44be366ac5369b42f60c81f37c 100644
|
| --- a/runtime/observatory/lib/src/elements/cpu_profile.dart
|
| +++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
|
| @@ -140,7 +140,9 @@ class ProfileCodeTrieNodeTreeRow extends TableTreeRow {
|
| @CustomTag('cpu-profile')
|
| class CpuProfileElement extends ObservatoryElement {
|
| CpuProfileElement.created() : super.created();
|
| - @published ServiceMap profile;
|
| + @published Isolate isolate;
|
| +
|
| + @observable ServiceMap profile;
|
| @observable bool hideTagsChecked;
|
| @observable String sampleCount = '';
|
| @observable String refreshTime = '';
|
| @@ -150,32 +152,28 @@ class CpuProfileElement extends ObservatoryElement {
|
| @observable String timeSpan = '';
|
| @reflectable double displayThreshold = 0.0002; // 0.02%.
|
|
|
| - @observable String tagSelector = 'uv';
|
| + @observable String tagSelector = 'UserVM';
|
|
|
| final _id = '#tableTree';
|
| TableTree tree;
|
|
|
| static const MICROSECONDS_PER_SECOND = 1000000.0;
|
|
|
| - void profileChanged(oldValue) {
|
| - if (profile == null) {
|
| + void isolateChanged(oldValue) {
|
| + if (isolate == null) {
|
| + profile = null;
|
| return;
|
| }
|
| - var totalSamples = profile['samples'];
|
| - var now = new DateTime.now();
|
| - sampleCount = totalSamples.toString();
|
| - refreshTime = now.toString();
|
| - sampleDepth = profile['depth'].toString();
|
| - var period = profile['period'];
|
| - sampleRate = (MICROSECONDS_PER_SECOND / period).toStringAsFixed(0);
|
| - timeSpan = formatTime(profile['timeSpan']);
|
| - displayCutoff = '${(displayThreshold * 100.0).toString()}%';
|
| - profile.isolate.processProfile(profile);
|
| - profile['threshold'] = displayThreshold;
|
| - _update();
|
| + isolate.invokeRpc('getCpuProfile', { 'tags': tagSelector })
|
| + .then((ServiceObject obj) {
|
| + print(obj);
|
| + // Assert we got back the a profile.
|
| + assert(obj.type == 'CpuProfile');
|
| + profile = obj;
|
| + _update();
|
| + });
|
| }
|
|
|
| -
|
| @override
|
| void attached() {
|
| super.attached();
|
| @@ -186,22 +184,34 @@ class CpuProfileElement extends ObservatoryElement {
|
| }
|
|
|
| void tagSelectorChanged(oldValue) {
|
| - refresh(null);
|
| + isolateChanged(null);
|
| }
|
|
|
| void refresh(var done) {
|
| - var request = 'profile?tags=$tagSelector';
|
| - profile.isolate.get(request).then((ServiceMap m) {
|
| - // Assert we got back the a profile.
|
| - assert(m.type == 'Profile');
|
| - profile = m;
|
| - }).whenComplete(done);
|
| + isolate.invokeRpc('getCpuProfile', { 'tags': tagSelector })
|
| + .then((ServiceObject obj) {
|
| + // Assert we got back the a profile.
|
| + assert(obj.type == 'CpuProfile');
|
| + profile = obj;
|
| + _update();
|
| + }).whenComplete(done);
|
| }
|
|
|
| void _update() {
|
| if (profile == null) {
|
| return;
|
| }
|
| + var totalSamples = profile['samples'];
|
| + var now = new DateTime.now();
|
| + sampleCount = totalSamples.toString();
|
| + refreshTime = now.toString();
|
| + sampleDepth = profile['depth'].toString();
|
| + var period = profile['period'];
|
| + sampleRate = (MICROSECONDS_PER_SECOND / period).toStringAsFixed(0);
|
| + timeSpan = formatTime(profile['timeSpan']);
|
| + displayCutoff = '${(displayThreshold * 100.0).toString()}%';
|
| + profile.isolate.processProfile(profile);
|
| + profile['threshold'] = displayThreshold;
|
| _buildTree();
|
| }
|
|
|
|
|