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

Side by Side Diff: runtime/vm/metrics.cc

Issue 1157173005: Include 'fixedId' key when printing service ids (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « runtime/vm/json_test.cc ('k') | runtime/vm/metrics_test.cc » ('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 #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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 77
78 void Metric::PrintJSON(JSONStream* stream) { 78 void Metric::PrintJSON(JSONStream* stream) {
79 JSONObject obj(stream); 79 JSONObject obj(stream);
80 obj.AddProperty("type", "Counter"); 80 obj.AddProperty("type", "Counter");
81 obj.AddProperty("name", name_); 81 obj.AddProperty("name", name_);
82 obj.AddProperty("description", description_); 82 obj.AddProperty("description", description_);
83 obj.AddProperty("unit", UnitString(unit())); 83 obj.AddProperty("unit", UnitString(unit()));
84 if (isolate_ == NULL) { 84 if (isolate_ == NULL) {
85 obj.AddPropertyF("id", "vm/metrics/%s", name_); 85 obj.AddFixedServiceId("vm/metrics/%s", name_);
86 } else { 86 } else {
87 obj.AddPropertyF("id", "metrics/native/%s", name_); 87 obj.AddFixedServiceId("metrics/native/%s", name_);
88 } 88 }
89 // TODO(johnmccutchan): Overflow? 89 // TODO(johnmccutchan): Overflow?
90 double value_as_double = static_cast<double>(Value()); 90 double value_as_double = static_cast<double>(Value());
91 obj.AddProperty("value", value_as_double); 91 obj.AddProperty("value", value_as_double);
92 } 92 }
93 93
94 94
95 bool Metric::NameExists(Metric* head, const char* name) { 95 bool Metric::NameExists(Metric* head, const char* name) {
96 ASSERT(name != NULL); 96 ASSERT(name != NULL);
97 while (head != NULL) { 97 while (head != NULL) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 242
243 void Metric::InitOnce() { 243 void Metric::InitOnce() {
244 #define VM_METRIC_INIT(type, variable, name, unit) \ 244 #define VM_METRIC_INIT(type, variable, name, unit) \
245 vm_metric_##variable##_.Init(name, NULL, Metric::unit); 245 vm_metric_##variable##_.Init(name, NULL, Metric::unit);
246 VM_METRIC_LIST(VM_METRIC_INIT); 246 VM_METRIC_LIST(VM_METRIC_INIT);
247 #undef VM_METRIC_INIT 247 #undef VM_METRIC_INIT
248 } 248 }
249 249
250 } // namespace dart 250 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_test.cc ('k') | runtime/vm/metrics_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698