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

Side by Side Diff: sdk/lib/developer/profiler.dart

Issue 2754013002: Format all dart: library files (Closed)
Patch Set: Format all dart: library files Created 3 years, 9 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
« no previous file with comments | « sdk/lib/developer/extension.dart ('k') | sdk/lib/developer/service.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart.developer; 5 part of dart.developer;
6 6
7 /// A UserTag can be used to group samples in the Observatory profiler. 7 /// A UserTag can be used to group samples in the Observatory profiler.
8 abstract class UserTag { 8 abstract class UserTag {
9 /// The maximum number of UserTag instances that can be created by a program. 9 /// The maximum number of UserTag instances that can be created by a program.
10 static const MAX_USER_TAGS = 64; 10 static const MAX_USER_TAGS = 64;
(...skipping 14 matching lines...) Expand all
25 /// Returns the current [UserTag] for the isolate. 25 /// Returns the current [UserTag] for the isolate.
26 external UserTag getCurrentTag(); 26 external UserTag getCurrentTag();
27 27
28 /// Abstract [Metric] class. Metric names must be unique, are hierarchical, 28 /// Abstract [Metric] class. Metric names must be unique, are hierarchical,
29 /// and use periods as separators. For example, 'a.b.c'. Uniqueness is only 29 /// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
30 /// enforced when a Metric is registered. The name of a metric cannot contain 30 /// enforced when a Metric is registered. The name of a metric cannot contain
31 /// the slash ('/') character. 31 /// the slash ('/') character.
32 abstract class Metric { 32 abstract class Metric {
33 /// [name] of this metric. 33 /// [name] of this metric.
34 final String name; 34 final String name;
35
35 /// [description] of this metric. 36 /// [description] of this metric.
36 final String description; 37 final String description;
37 38
38 Metric(this.name, this.description) { 39 Metric(this.name, this.description) {
39 if ((name == 'vm') || name.contains('/')) { 40 if ((name == 'vm') || name.contains('/')) {
40 throw new ArgumentError('Invalid Metric name.'); 41 throw new ArgumentError('Invalid Metric name.');
41 } 42 }
42
43 } 43 }
44 44
45 Map _toJSON(); 45 Map _toJSON();
46 } 46 }
47 47
48 /// A measured value with a min and max. Initial value is min. Value will 48 /// A measured value with a min and max. Initial value is min. Value will
49 /// be clamped to the interval [min, max]. 49 /// be clamped to the interval [min, max].
50 class Gauge extends Metric { 50 class Gauge extends Metric {
51 final double min; 51 final double min;
52 final double max; 52 final double max;
(...skipping 30 matching lines...) Expand all
83 'name': name, 83 'name': name,
84 'description': description, 84 'description': description,
85 'value': value, 85 'value': value,
86 'min': min, 86 'min': min,
87 'max': max, 87 'max': max,
88 }; 88 };
89 return map; 89 return map;
90 } 90 }
91 } 91 }
92 92
93
94 /// A changing value. Initial value is 0.0. 93 /// A changing value. Initial value is 0.0.
95 class Counter extends Metric { 94 class Counter extends Metric {
96 Counter(String name, String description) 95 Counter(String name, String description) : super(name, description);
97 : super(name, description);
98 96
99 double _value = 0.0; 97 double _value = 0.0;
100 double get value => _value; 98 double get value => _value;
101 set value(double v) { 99 set value(double v) {
102 _value = v; 100 _value = v;
103 } 101 }
104 102
105 Map _toJSON() { 103 Map _toJSON() {
106 var map = { 104 var map = {
107 'type': 'Counter', 105 'type': 'Counter',
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 for (var metric in _metrics.values) { 147 for (var metric in _metrics.values) {
150 metrics.add(metric._toJSON()); 148 metrics.add(metric._toJSON());
151 } 149 }
152 var map = { 150 var map = {
153 'type': 'MetricList', 151 'type': 'MetricList',
154 'metrics': metrics, 152 'metrics': metrics,
155 }; 153 };
156 return JSON.encode(map); 154 return JSON.encode(map);
157 } 155 }
158 } 156 }
OLDNEW
« no previous file with comments | « sdk/lib/developer/extension.dart ('k') | sdk/lib/developer/service.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698