OLD | NEW |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 static String _printMetric(String id) { | 180 static String _printMetric(String id) { |
181 var metric = _metrics[id]; | 181 var metric = _metrics[id]; |
182 if (metric == null) { | 182 if (metric == null) { |
183 return null; | 183 return null; |
184 } | 184 } |
185 return JSON.encode(metric._toJSON()); | 185 return JSON.encode(metric._toJSON()); |
186 } | 186 } |
187 | 187 |
188 static String _printMetrics() { | 188 static String _printMetrics() { |
189 var members = []; | 189 var metrics = []; |
190 for (var metric in _metrics.values) { | 190 for (var metric in _metrics.values) { |
191 members.add(metric._toJSON()); | 191 metrics.add(metric._toJSON()); |
192 } | 192 } |
193 var map = { | 193 var map = { |
194 'type': 'MetricList', | 194 'type': 'MetricList', |
195 'id': 'metrics', | 195 'metrics': metrics, |
196 'members': members, | |
197 }; | 196 }; |
198 return JSON.encode(map); | 197 return JSON.encode(map); |
199 } | 198 } |
200 } | 199 } |
OLD | NEW |