34 : public AllStatic {
35 public:
36 enum VMTagId {
37 kInvalidTagId = 0,
38#define DEFINE_VM_TAG_ID(tag) k##tag##TagId,
40#undef DEFINE_VM_TAG_KIND
41 kNumVMTags,
42
43
44
45
46 kRootTagId,
47 kTruncatedTagId,
48
49 kNoneCodeTagId,
50 kOptimizedCodeTagId,
51 kUnoptimizedCodeTagId,
52 kNativeCodeTagId,
53 kInlineStartCodeTagId,
54 kInlineEndCodeTagId,
55 kLastTagId,
56 };
57
58 static bool IsVMTag(uword id) {
59 return (id != kInvalidTagId) && (id < kNumVMTags);
60 }
61 static const char* TagName(uword id);
62 static bool IsNativeEntryTag(uword id);
63 static bool IsDartTag(uword id) { return id == kDartTagId; }
64 static bool IsExitFrameTag(uword id);
65 static bool IsRuntimeEntryTag(uword id);
66 static const char* RuntimeEntryTagName(uword id);
67
68 static void RegisterRuntimeEntry(RuntimeEntry* runtime_entry);
69
70 private:
71 struct TagEntry {
74 };
75 static const TagEntry entries_[];
76};
77
78class VMTagScope : ThreadStackResource {
79 public:
80 VMTagScope(Thread* thread, uword tag, bool conditional_set = true);
81 ~VMTagScope();
82
83 private:
85
88};
89
90class VMTagCounters {
91 public:
92 VMTagCounters();
93
94 void Increment(uword tag);
95
96 int64_t
count(uword tag);
97
98#ifndef PRODUCT
99 void PrintToJSONObject(JSONObject* obj);
100#endif
101
102 private:
103 int64_t counters_[VMTag::kNumVMTags];
104};
105
106class UserTags : public AllStatic {
107 public:
108
109 static constexpr intptr_t kMaxUserTags = 256;
110 static constexpr uword kUserTagIdOffset = 0x4096;
111 static constexpr uword kDefaultUserTag = kUserTagIdOffset;
112 static const char* TagName(uword tag_id);
113 static bool IsUserTag(uword tag_id) {
114 return (tag_id >= kUserTagIdOffset) &&
115 (tag_id < kUserTagIdOffset + kMaxUserTags);
116 }
117 static void AddStreamableTagName(const char* tag);
118 static void RemoveStreamableTagName(const char* tag);
119 static bool IsTagNameStreamable(const char* tag);
122
123 private:
124 static Mutex* subscribed_tags_lock_;
125 static MallocGrowableArray<const char*> subscribed_tags_;
126};
127
128}
129
130#endif