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

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

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
« no previous file with comments | « runtime/vm/symbols.h ('k') | runtime/vm/tags.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #ifndef VM_TAGS_H_ 5 #ifndef VM_TAGS_H_
6 #define VM_TAGS_H_ 6 #define VM_TAGS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 class Isolate; 12 class Isolate;
13 class JSONObject; 13 class JSONObject;
14 class RuntimeEntry; 14 class RuntimeEntry;
15 15
16 #define VM_TAG_LIST(V) \ 16 #define VM_TAG_LIST(V) \
17 V(Idle) \ 17 V(Idle) \
18 V(VM) /* Catch all */ \ 18 V(VM) /* Catch all */ \
19 V(Compile) \ 19 V(Compile) \
20 V(Script) \ 20 V(Script) \
21 V(GCNewSpace) \ 21 V(GCNewSpace) \
22 V(GCOldSpace) \ 22 V(GCOldSpace) \
23 V(Runtime) \ 23 V(Runtime) \
24 V(Native) \ 24 V(Native) \
25 25
26
27 class VMTag : public AllStatic { 26 class VMTag : public AllStatic {
28 public: 27 public:
29 enum VMTagId { 28 enum VMTagId {
30 kInvalidTagId = 0, 29 kInvalidTagId = 0,
31 #define DEFINE_VM_TAG_ID(tag) \ 30 #define DEFINE_VM_TAG_ID(tag) \
32 k##tag##TagId, 31 k##tag##TagId,
33 VM_TAG_LIST(DEFINE_VM_TAG_ID) 32 VM_TAG_LIST(DEFINE_VM_TAG_ID)
34 #undef DEFINE_VM_TAG_KIND 33 #undef DEFINE_VM_TAG_KIND
35 kNumVMTags, 34 kNumVMTags,
36 }; 35 };
37 36
37 static bool IsVMTag(uword id) {
38 return (id != kInvalidTagId) && (id < kNumVMTags);
39 }
38 static const char* TagName(uword id); 40 static const char* TagName(uword id);
39 static bool IsNativeEntryTag(uword id); 41 static bool IsNativeEntryTag(uword id);
40 42
41 static bool IsRuntimeEntryTag(uword id); 43 static bool IsRuntimeEntryTag(uword id);
42 static const char* RuntimeEntryTagName(uword id); 44 static const char* RuntimeEntryTagName(uword id);
43 45
44 static void RegisterRuntimeEntry(RuntimeEntry* runtime_entry); 46 static void RegisterRuntimeEntry(RuntimeEntry* runtime_entry);
45 47
46 private: 48 private:
47 struct TagEntry { 49 struct TagEntry {
(...skipping 23 matching lines...) Expand all
71 void Increment(uword tag); 73 void Increment(uword tag);
72 74
73 int64_t count(uword tag); 75 int64_t count(uword tag);
74 76
75 void PrintToJSONObject(JSONObject* obj); 77 void PrintToJSONObject(JSONObject* obj);
76 78
77 private: 79 private:
78 int64_t counters_[VMTag::kNumVMTags]; 80 int64_t counters_[VMTag::kNumVMTags];
79 }; 81 };
80 82
83
84 class UserTags : public AllStatic {
85 public:
86 static const uword kNoUserTag = 0;
87 // UserTag id space: [kUserTagIdOffset, kUserTagIdOffset + kMaxUserTags).
88 static const intptr_t kMaxUserTags = 64;
89 static const uword kUserTagIdOffset = 0x4096;
90 static const char* TagName(uword tag_id);
91 static bool IsUserTag(uword tag_id) {
92 return (tag_id >= kUserTagIdOffset) &&
93 (tag_id < kUserTagIdOffset + kMaxUserTags);
94 }
95 };
96
97
81 } // namespace dart 98 } // namespace dart
82 99
83 #endif // VM_TAGS_H_ 100 #endif // VM_TAGS_H_
OLDNEW
« no previous file with comments | « runtime/vm/symbols.h ('k') | runtime/vm/tags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698