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 #include "vm/metrics.h" | 5 #include "vm/metrics.h" |
6 | 6 |
7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/json_stream.h" | 8 #include "vm/json_stream.h" |
9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 case Metric::kByte: return "byte"; | 73 case Metric::kByte: return "byte"; |
74 default: | 74 default: |
75 UNREACHABLE(); | 75 UNREACHABLE(); |
76 } | 76 } |
77 UNREACHABLE(); | 77 UNREACHABLE(); |
78 return NULL; | 78 return NULL; |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 void Metric::PrintJSON(JSONStream* stream) { | 82 void Metric::PrintJSON(JSONStream* stream) { |
| 83 if (!FLAG_support_service) { |
| 84 return; |
| 85 } |
83 JSONObject obj(stream); | 86 JSONObject obj(stream); |
84 obj.AddProperty("type", "Counter"); | 87 obj.AddProperty("type", "Counter"); |
85 obj.AddProperty("name", name_); | 88 obj.AddProperty("name", name_); |
86 obj.AddProperty("description", description_); | 89 obj.AddProperty("description", description_); |
87 obj.AddProperty("unit", UnitString(unit())); | 90 obj.AddProperty("unit", UnitString(unit())); |
88 if (isolate_ == NULL) { | 91 if (isolate_ == NULL) { |
89 obj.AddFixedServiceId("vm/metrics/%s", name_); | 92 obj.AddFixedServiceId("vm/metrics/%s", name_); |
90 } else { | 93 } else { |
91 obj.AddFixedServiceId("metrics/native/%s", name_); | 94 obj.AddFixedServiceId("metrics/native/%s", name_); |
92 } | 95 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 336 } |
334 | 337 |
335 | 338 |
336 void MinMetric::SetValue(int64_t new_value) { | 339 void MinMetric::SetValue(int64_t new_value) { |
337 if (new_value < value()) { | 340 if (new_value < value()) { |
338 set_value(new_value); | 341 set_value(new_value); |
339 } | 342 } |
340 } | 343 } |
341 | 344 |
342 } // namespace dart | 345 } // namespace dart |
OLD | NEW |