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

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

Issue 464953002: Add VMMetric and some sample metrics (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « runtime/vm/vm_sources.gypi ('k') | tests/lib/profiler/metrics_test.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 library dart.profiler; 5 library dart.profiler;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 /// A UserTag can be used to group samples in the Observatory profiler. 9 /// A UserTag can be used to group samples in the Observatory profiler.
10 abstract class UserTag { 10 abstract class UserTag {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /// and use periods as separators. For example, 'a.b.c'. Uniqueness is only 70 /// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
71 /// enforced when a Metric is registered. The name of a metric cannot contain 71 /// enforced when a Metric is registered. The name of a metric cannot contain
72 /// the slash ('/') character. 72 /// the slash ('/') character.
73 abstract class Metric { 73 abstract class Metric {
74 /// [name] of this metric. 74 /// [name] of this metric.
75 final String name; 75 final String name;
76 /// [description] of this metric. 76 /// [description] of this metric.
77 final String description; 77 final String description;
78 78
79 Metric(this.name, this.description) { 79 Metric(this.name, this.description) {
80 if (name.contains('/')) { 80 if ((name == 'vm') || name.contains('/')) {
81 throw new ArgumentError('Invalid Metric name.'); 81 throw new ArgumentError('Invalid Metric name.');
82 } 82 }
83
83 } 84 }
84 85
85 Map _toJSON(); 86 Map _toJSON();
86 } 87 }
87 88
88 /// A measured value with a min and max. Initial value is min. Value will 89 /// A measured value with a min and max. Initial value is min. Value will
89 /// be clamped to the interval [min, max]. 90 /// be clamped to the interval [min, max].
90 class Gauge extends Metric { 91 class Gauge extends Metric {
91 final double min; 92 final double min;
92 final double max; 93 final double max;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 members.add(metric._toJSON()); 191 members.add(metric._toJSON());
191 } 192 }
192 var map = { 193 var map = {
193 'type': 'MetricList', 194 'type': 'MetricList',
194 'id': 'metrics', 195 'id': 'metrics',
195 'members': members, 196 'members': members,
196 }; 197 };
197 return JSON.encode(map); 198 return JSON.encode(map);
198 } 199 }
199 } 200 }
OLDNEW
« no previous file with comments | « runtime/vm/vm_sources.gypi ('k') | tests/lib/profiler/metrics_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698