OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #ifndef V8_CPU_PROFILER_H_ | 28 #ifndef V8_CPU_PROFILER_H_ |
29 #define V8_CPU_PROFILER_H_ | 29 #define V8_CPU_PROFILER_H_ |
30 | 30 |
31 #include "circular-queue.h" | 31 #include "circular-queue.h" |
32 #include "profile-generator.h" | 32 #include "profile-generator.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
| 37 #ifdef ENABLE_CPP_PROFILES_PROCESSOR |
37 | 38 |
38 #define CODE_EVENTS_TYPE_LIST(V) \ | 39 #define CODE_EVENTS_TYPE_LIST(V) \ |
39 V(CODE_CREATION, CodeCreateEventRecord) \ | 40 V(CODE_CREATION, CodeCreateEventRecord) \ |
40 V(CODE_MOVE, CodeMoveEventRecord) \ | 41 V(CODE_MOVE, CodeMoveEventRecord) \ |
41 V(CODE_DELETE, CodeDeleteEventRecord) \ | 42 V(CODE_DELETE, CodeDeleteEventRecord) \ |
42 V(CODE_ALIAS, CodeAliasEventRecord) | 43 V(CODE_ALIAS, CodeAliasEventRecord) |
43 | 44 |
44 | 45 |
45 class CodeEventRecord { | 46 class CodeEventRecord { |
46 public: | 47 public: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 public: | 95 public: |
95 Address alias; | 96 Address alias; |
96 Address start; | 97 Address start; |
97 | 98 |
98 INLINE(void UpdateCodeMap(CodeMap* code_map)) { | 99 INLINE(void UpdateCodeMap(CodeMap* code_map)) { |
99 code_map->AddAlias(alias, start); | 100 code_map->AddAlias(alias, start); |
100 } | 101 } |
101 }; | 102 }; |
102 | 103 |
103 | 104 |
104 class TickSampleEventRecord { | 105 class TickSampleEventRecord BASE_EMBEDDED { |
105 public: | 106 public: |
106 // In memory, the first machine word of a TickSampleEventRecord will be the | 107 // In memory, the first machine word of a TickSampleEventRecord will be the |
107 // first entry of TickSample, that is -- a program counter field. | 108 // first entry of TickSample, that is -- a program counter field. |
108 // TickSample is put first, because 'order' can become equal to | 109 // TickSample is put first, because 'order' can become equal to |
109 // SamplingCircularQueue::kClear, while program counter can't. | 110 // SamplingCircularQueue::kClear, while program counter can't. |
110 TickSample sample; | 111 TickSample sample; |
111 unsigned order; | 112 unsigned order; |
112 | 113 |
113 #if defined(__GNUC__) && (__GNUC__ < 4) | 114 static TickSampleEventRecord* cast(void* value) { |
114 // Added to avoid 'all member functions in class are private' warning. | 115 return reinterpret_cast<TickSampleEventRecord*>(value); |
115 INLINE(unsigned get_order() const) { return order; } | 116 } |
116 // Added to avoid 'class only defines private constructors and | 117 |
117 // has no friends' warning. | |
118 friend class TickSampleEventRecordFriend; | |
119 #endif | |
120 private: | 118 private: |
121 // Disable instantiation. | 119 DISALLOW_IMPLICIT_CONSTRUCTORS(TickSampleEventRecord); |
122 TickSampleEventRecord(); | |
123 | |
124 DISALLOW_COPY_AND_ASSIGN(TickSampleEventRecord); | |
125 }; | 120 }; |
126 | 121 |
127 | 122 |
128 // This class implements both the profile events processor thread and | 123 // This class implements both the profile events processor thread and |
129 // methods called by event producers: VM and stack sampler threads. | 124 // methods called by event producers: VM and stack sampler threads. |
130 class ProfilerEventsProcessor : public Thread { | 125 class ProfilerEventsProcessor : public Thread { |
131 public: | 126 public: |
132 explicit ProfilerEventsProcessor(ProfileGenerator* generator); | 127 explicit ProfilerEventsProcessor(ProfileGenerator* generator); |
133 virtual ~ProfilerEventsProcessor() { } | 128 virtual ~ProfilerEventsProcessor() { } |
134 | 129 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 bool ProcessCodeEvent(unsigned* dequeue_order); | 167 bool ProcessCodeEvent(unsigned* dequeue_order); |
173 bool ProcessTicks(unsigned dequeue_order); | 168 bool ProcessTicks(unsigned dequeue_order); |
174 | 169 |
175 ProfileGenerator* generator_; | 170 ProfileGenerator* generator_; |
176 bool running_; | 171 bool running_; |
177 CircularQueue<CodeEventsContainer> events_buffer_; | 172 CircularQueue<CodeEventsContainer> events_buffer_; |
178 SamplingCircularQueue ticks_buffer_; | 173 SamplingCircularQueue ticks_buffer_; |
179 unsigned enqueue_order_; | 174 unsigned enqueue_order_; |
180 }; | 175 }; |
181 | 176 |
| 177 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
182 | 178 |
183 } } // namespace v8::internal | 179 } } // namespace v8::internal |
184 | 180 |
185 #endif // V8_CPU_PROFILER_H_ | 181 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |