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/tags.h" | 5 #include "vm/tags.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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 int64_t VMTagCounters::count(uword tag) { | 133 int64_t VMTagCounters::count(uword tag) { |
134 ASSERT(tag != VMTag::kInvalidTagId); | 134 ASSERT(tag != VMTag::kInvalidTagId); |
135 ASSERT(tag < VMTag::kNumVMTags); | 135 ASSERT(tag < VMTag::kNumVMTags); |
136 return counters_[tag]; | 136 return counters_[tag]; |
137 } | 137 } |
138 | 138 |
139 | 139 |
| 140 #ifndef PRODUCT |
140 void VMTagCounters::PrintToJSONObject(JSONObject* obj) { | 141 void VMTagCounters::PrintToJSONObject(JSONObject* obj) { |
141 if (!FLAG_support_service) { | 142 if (!FLAG_support_service) { |
142 return; | 143 return; |
143 } | 144 } |
144 { | 145 { |
145 JSONArray arr(obj, "names"); | 146 JSONArray arr(obj, "names"); |
146 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { | 147 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { |
147 arr.AddValue(VMTag::TagName(i)); | 148 arr.AddValue(VMTag::TagName(i)); |
148 } | 149 } |
149 } | 150 } |
150 { | 151 { |
151 JSONArray arr(obj, "counters"); | 152 JSONArray arr(obj, "counters"); |
152 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { | 153 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { |
153 arr.AddValue64(counters_[i]); | 154 arr.AddValue64(counters_[i]); |
154 } | 155 } |
155 } | 156 } |
156 } | 157 } |
| 158 #endif // !PRODUCT |
157 | 159 |
158 | 160 |
159 const char* UserTags::TagName(uword tag_id) { | 161 const char* UserTags::TagName(uword tag_id) { |
160 ASSERT(tag_id >= kUserTagIdOffset); | 162 ASSERT(tag_id >= kUserTagIdOffset); |
161 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); | 163 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); |
162 Zone* zone = Thread::Current()->zone(); | 164 Zone* zone = Thread::Current()->zone(); |
163 const UserTag& tag = | 165 const UserTag& tag = |
164 UserTag::Handle(zone, UserTag::FindTagById(tag_id)); | 166 UserTag::Handle(zone, UserTag::FindTagById(tag_id)); |
165 ASSERT(!tag.IsNull()); | 167 ASSERT(!tag.IsNull()); |
166 const String& label = String::Handle(zone, tag.label()); | 168 const String& label = String::Handle(zone, tag.label()); |
167 return label.ToCString(); | 169 return label.ToCString(); |
168 } | 170 } |
169 | 171 |
170 | 172 |
171 } // namespace dart | 173 } // namespace dart |
OLD | NEW |