| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 | 121 |
| 122 int64_t VMTagCounters::count(uword tag) { | 122 int64_t VMTagCounters::count(uword tag) { |
| 123 ASSERT(tag != VMTag::kInvalidTagId); | 123 ASSERT(tag != VMTag::kInvalidTagId); |
| 124 ASSERT(tag < VMTag::kNumVMTags); | 124 ASSERT(tag < VMTag::kNumVMTags); |
| 125 return counters_[tag]; | 125 return counters_[tag]; |
| 126 } | 126 } |
| 127 | 127 |
| 128 | 128 |
| 129 void VMTagCounters::PrintToJSONObject(JSONObject* obj) { | 129 void VMTagCounters::PrintToJSONObject(JSONObject* obj) { |
| 130 if (!FLAG_support_service) { |
| 131 return; |
| 132 } |
| 130 { | 133 { |
| 131 JSONArray arr(obj, "names"); | 134 JSONArray arr(obj, "names"); |
| 132 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { | 135 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { |
| 133 arr.AddValue(VMTag::TagName(i)); | 136 arr.AddValue(VMTag::TagName(i)); |
| 134 } | 137 } |
| 135 } | 138 } |
| 136 { | 139 { |
| 137 JSONArray arr(obj, "counters"); | 140 JSONArray arr(obj, "counters"); |
| 138 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { | 141 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { |
| 139 arr.AddValue64(counters_[i]); | 142 arr.AddValue64(counters_[i]); |
| 140 } | 143 } |
| 141 } | 144 } |
| 142 } | 145 } |
| 143 | 146 |
| 144 | 147 |
| 145 const char* UserTags::TagName(uword tag_id) { | 148 const char* UserTags::TagName(uword tag_id) { |
| 146 ASSERT(tag_id >= kUserTagIdOffset); | 149 ASSERT(tag_id >= kUserTagIdOffset); |
| 147 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); | 150 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); |
| 148 Zone* zone = Thread::Current()->zone(); | 151 Zone* zone = Thread::Current()->zone(); |
| 149 const UserTag& tag = | 152 const UserTag& tag = |
| 150 UserTag::Handle(zone, UserTag::FindTagById(tag_id)); | 153 UserTag::Handle(zone, UserTag::FindTagById(tag_id)); |
| 151 ASSERT(!tag.IsNull()); | 154 ASSERT(!tag.IsNull()); |
| 152 const String& label = String::Handle(zone, tag.label()); | 155 const String& label = String::Handle(zone, tag.label()); |
| 153 return label.ToCString(); | 156 return label.ToCString(); |
| 154 } | 157 } |
| 155 | 158 |
| 156 | 159 |
| 157 } // namespace dart | 160 } // namespace dart |
| OLD | NEW |