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

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

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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/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"
11 #include "vm/object.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 const char* VMTag::TagName(uword tag) { 15 const char* VMTag::TagName(uword tag) {
15 if (IsNativeEntryTag(tag)) { 16 if (IsNativeEntryTag(tag)) {
16 const uint8_t* native_reverse_lookup = NativeEntry::ResolveSymbol(tag); 17 const uint8_t* native_reverse_lookup = NativeEntry::ResolveSymbol(tag);
17 if (native_reverse_lookup != NULL) { 18 if (native_reverse_lookup != NULL) {
18 return reinterpret_cast<const char*>(native_reverse_lookup); 19 return reinterpret_cast<const char*>(native_reverse_lookup);
19 } 20 }
20 return "Unknown native entry"; 21 return "Unknown native entry";
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 132 }
132 } 133 }
133 { 134 {
134 JSONArray arr(obj, "counters"); 135 JSONArray arr(obj, "counters");
135 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { 136 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) {
136 arr.AddValue64(counters_[i]); 137 arr.AddValue64(counters_[i]);
137 } 138 }
138 } 139 }
139 } 140 }
140 141
142
143 const char* UserTags::TagName(uword tag_address) {
144 ASSERT(tag_address >= kUserTagIdOffset);
145 ASSERT(tag_address < kUserTagIdOffset + kMaxUserTags);
146 Isolate* isolate = Isolate::Current();
147 const UserTag& tag =
148 UserTag::Handle(isolate, UserTag::FindTagById(tag_address));
149 ASSERT(!tag.IsNull());
150 const String& label = String::Handle(isolate, tag.label());
151 return label.ToCString();
152 }
153
154
141 } // namespace dart 155 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/tags.h ('k') | runtime/vm/vm.gypi » ('j') | sdk/lib/profiler/profiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698