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

Side by Side Diff: runtime/observatory/lib/src/elements/metrics.dart

Issue 886353006: Port metrics to RPC (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 metrics; 5 library metrics;
6 6
7 import 'dart:async';
8 import 'dart:html'; 7 import 'dart:html';
9 import 'observatory_element.dart'; 8 import 'observatory_element.dart';
10 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
11 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
12 import 'package:polymer/polymer.dart'; 11 import 'package:polymer/polymer.dart';
13 12
14 @CustomTag('metrics-page') 13 @CustomTag('metrics-page')
15 class MetricsPageElement extends ObservatoryElement { 14 class MetricsPageElement extends ObservatoryElement {
16 MetricsPageElement.created() : super.created(); 15 MetricsPageElement.created() : super.created();
17 16
18 @observable MetricsPage page; 17 @observable MetricsPage page;
19 @observable Isolate isolate; 18 @observable Isolate isolate;
20 @observable ServiceMetric selectedMetric; 19 @observable ServiceMetric selectedMetric;
21 20
22 void _autoPickSelectedMetric() { 21 void _autoPickSelectedMetric() {
23 if (selectedMetric != null) { 22 if (selectedMetric != null) {
24 return; 23 return;
25 } 24 }
26 // Attempt to pick the last selected metric. 25 // Attempt to pick the last selected metric.
27 if ((isolate != null) && (page != null) && 26 if ((isolate != null) && (page != null) &&
28 (page.selectedMetricId != null)) { 27 (page.selectedMetricId != null)) {
29 selectedMetric = isolate.dartMetrics[page.selectedMetricId]; 28 selectedMetric = isolate.dartMetrics[page.selectedMetricId];
30 if (selectedMetric == null) { 29 if (selectedMetric == null) {
31 selectedMetric = isolate.vmMetrics[page.selectedMetricId]; 30 selectedMetric = isolate.nativeMetrics[page.selectedMetricId];
32 } 31 }
33 } 32 }
34 if ((selectedMetric == null) && (isolate != null)) { 33 if ((selectedMetric == null) && (isolate != null)) {
35 var values = isolate.dartMetrics.values; 34 var values = isolate.dartMetrics.values;
36 if (values != null) { 35 if (values != null) {
37 // Fall back and pick the first isolate metric. 36 // Fall back and pick the first isolate metric.
38 selectedMetric = values.first; 37 selectedMetric = values.first;
39 } 38 }
40 } 39 }
41 } 40 }
(...skipping 12 matching lines...) Expand all
54 53
55 void refresh(var done) { 54 void refresh(var done) {
56 isolate.refreshMetrics().whenComplete(done); 55 isolate.refreshMetrics().whenComplete(done);
57 } 56 }
58 57
59 void selectMetric(Event e, var detail, Element target) { 58 void selectMetric(Event e, var detail, Element target) {
60 String id = target.attributes['data-id']; 59 String id = target.attributes['data-id'];
61 selectedMetric = isolate.dartMetrics[id]; 60 selectedMetric = isolate.dartMetrics[id];
62 if (selectedMetric == null) { 61 if (selectedMetric == null) {
63 // Check VM metrics. 62 // Check VM metrics.
64 selectedMetric = isolate.vmMetrics[id]; 63 selectedMetric = isolate.nativeMetrics[id];
65 } 64 }
66 if (selectedMetric != null) { 65 if (selectedMetric != null) {
67 page.selectedMetricId = id; 66 page.selectedMetricId = id;
68 } else { 67 } else {
69 page.selectedMetricId = null; 68 page.selectedMetricId = null;
70 } 69 }
71 } 70 }
72 } 71 }
73 72
74 @CustomTag('metric-details') 73 @CustomTag('metric-details')
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 _table.addTimeOfDayValue(sample.time, sample.value); 189 _table.addTimeOfDayValue(sample.time, sample.value);
191 } 190 }
192 } 191 }
193 192
194 metricChanged(oldValue) { 193 metricChanged(oldValue) {
195 if (oldValue != metric) { 194 if (oldValue != metric) {
196 _setupInitialDataTable(); 195 _setupInitialDataTable();
197 } 196 }
198 } 197 }
199 } 198 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/error_ref.dart ('k') | runtime/observatory/lib/src/elements/metrics.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698