Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Unified Diff: runtime/observatory/lib/src/elements/cpu_profile.dart

Issue 823403004: Begin migrating the vm service from a rest-style interface to a json-rpc style interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove old-style standalone tests. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.dart ('k') | runtime/observatory/lib/src/elements/cpu_profile.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698