| 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_element; | 5 library cpu_profile_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'observatory_element.dart'; | 9 import 'observatory_element.dart'; |
| 10 import 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 478 |
| 479 void directionSelectorChanged(oldValue) { | 479 void directionSelectorChanged(oldValue) { |
| 480 _updateView(); | 480 _updateView(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 Future clearCpuProfile() { | 483 Future clearCpuProfile() { |
| 484 profile.clear(); | 484 profile.clear(); |
| 485 if (isolate == null) { | 485 if (isolate == null) { |
| 486 return new Future.value(null); | 486 return new Future.value(null); |
| 487 } | 487 } |
| 488 return isolate.invokeRpc('clearCpuProfile', { }) | 488 return isolate.invokeRpc('_clearCpuProfile', { }) |
| 489 .then((ServiceMap response) { | 489 .then((ServiceMap response) { |
| 490 _updateView(); | 490 _updateView(); |
| 491 }); | 491 }); |
| 492 } | 492 } |
| 493 | 493 |
| 494 Future refresh() { | 494 Future refresh() { |
| 495 return _getCpuProfile(); | 495 return _getCpuProfile(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 _onFetchStarted() { | 498 _onFetchStarted() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 528 if (codeTree != null) { | 528 if (codeTree != null) { |
| 529 codeTree.clear(); | 529 codeTree.clear(); |
| 530 codeTree = null; | 530 codeTree = null; |
| 531 } | 531 } |
| 532 if (isolate == null) { | 532 if (isolate == null) { |
| 533 return new Future.value(null); | 533 return new Future.value(null); |
| 534 } | 534 } |
| 535 _onFetchStarted(); | 535 _onFetchStarted(); |
| 536 try { | 536 try { |
| 537 var params = { 'tags': tagSelector }; | 537 var params = { 'tags': tagSelector }; |
| 538 var response = await isolate.invokeRpc('getCpuProfile', params); | 538 var response = await isolate.invokeRpc('_getCpuProfile', params); |
| 539 _onFetchFinished(); | 539 _onFetchFinished(); |
| 540 await _onLoadStarted(); | 540 await _onLoadStarted(); |
| 541 profile.load(isolate, response); | 541 profile.load(isolate, response); |
| 542 _onLoadFinished(); | 542 _onLoadFinished(); |
| 543 _updateView(); | 543 _updateView(); |
| 544 } catch (e, st) { | 544 } catch (e, st) { |
| 545 bool handled = false; | 545 bool handled = false; |
| 546 if (e is ServerRpcException) { | 546 if (e is ServerRpcException) { |
| 547 ServerRpcException se = e; | 547 ServerRpcException se = e; |
| 548 if (se.code == ServerRpcException.kProfilingDisabled) { | 548 if (se.code == ServerRpcException.kProfilingDisabled) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 loadTime = formatTimeMilliseconds(_sw.elapsedMilliseconds); | 843 loadTime = formatTimeMilliseconds(_sw.elapsedMilliseconds); |
| 844 state = 'Loaded'; | 844 state = 'Loaded'; |
| 845 } | 845 } |
| 846 | 846 |
| 847 Future clearCpuProfile() { | 847 Future clearCpuProfile() { |
| 848 profile.clear(); | 848 profile.clear(); |
| 849 _clearView(); | 849 _clearView(); |
| 850 if (isolate == null) { | 850 if (isolate == null) { |
| 851 return new Future.value(null); | 851 return new Future.value(null); |
| 852 } | 852 } |
| 853 return isolate.invokeRpc('clearCpuProfile', { }) | 853 return isolate.invokeRpc('_clearCpuProfile', { }) |
| 854 .then((ServiceMap response) { | 854 .then((ServiceMap response) { |
| 855 _updateView(); | 855 _updateView(); |
| 856 }); | 856 }); |
| 857 } | 857 } |
| 858 | 858 |
| 859 Future _getCpuProfile() async { | 859 Future _getCpuProfile() async { |
| 860 profile.clear(); | 860 profile.clear(); |
| 861 _clearView(); | 861 _clearView(); |
| 862 if (isolate == null) { | 862 if (isolate == null) { |
| 863 return new Future.value(null); | 863 return new Future.value(null); |
| 864 } | 864 } |
| 865 _onFetchStarted(); | 865 _onFetchStarted(); |
| 866 try { | 866 try { |
| 867 var params = { 'tags': 'None' }; | 867 var params = { 'tags': 'None' }; |
| 868 var response = await isolate.invokeRpc('getCpuProfile', params); | 868 var response = await isolate.invokeRpc('_getCpuProfile', params); |
| 869 _onFetchFinished(); | 869 _onFetchFinished(); |
| 870 _onLoadStarted(); | 870 _onLoadStarted(); |
| 871 profile.load(isolate, response); | 871 profile.load(isolate, response); |
| 872 profile.buildFunctionCallerAndCallees(); | 872 profile.buildFunctionCallerAndCallees(); |
| 873 _onLoadFinished(); | 873 _onLoadFinished(); |
| 874 _updateView(); | 874 _updateView(); |
| 875 } catch (e, st) { | 875 } catch (e, st) { |
| 876 bool handled = false; | 876 bool handled = false; |
| 877 if (e is ServerRpcException) { | 877 if (e is ServerRpcException) { |
| 878 ServerRpcException se = e; | 878 ServerRpcException se = e; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 } | 1123 } |
| 1124 var filter = (FunctionCallTreeNode node) { | 1124 var filter = (FunctionCallTreeNode node) { |
| 1125 return node.profileFunction.function == focusedFunction; | 1125 return node.profileFunction.function == focusedFunction; |
| 1126 }; | 1126 }; |
| 1127 tree = tree.filtered(filter); | 1127 tree = tree.filtered(filter); |
| 1128 var rootRow = | 1128 var rootRow = |
| 1129 new FunctionProfileTreeRow(functionTree, null, profile, tree.root); | 1129 new FunctionProfileTreeRow(functionTree, null, profile, tree.root); |
| 1130 functionTree.initialize(rootRow); | 1130 functionTree.initialize(rootRow); |
| 1131 } | 1131 } |
| 1132 } | 1132 } |
| OLD | NEW |