OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 static TickSampleEventRecord* cast(void* value) { | 118 static TickSampleEventRecord* cast(void* value) { |
119 return reinterpret_cast<TickSampleEventRecord*>(value); | 119 return reinterpret_cast<TickSampleEventRecord*>(value); |
120 } | 120 } |
121 }; | 121 }; |
122 | 122 |
123 | 123 |
124 // This class implements both the profile events processor thread and | 124 // This class implements both the profile events processor thread and |
125 // methods called by event producers: VM and stack sampler threads. | 125 // methods called by event producers: VM and stack sampler threads. |
126 class ProfilerEventsProcessor : public Thread { | 126 class ProfilerEventsProcessor : public Thread { |
127 public: | 127 public: |
128 explicit ProfilerEventsProcessor(ProfileGenerator* generator); | 128 explicit ProfilerEventsProcessor(ProfileGenerator* generator, |
Jakob Kummerow
2013/04/25 16:06:39
nit: "explicit" not needed any more when you have
yurys
2013/04/26 07:49:38
Done.
| |
129 CpuProfilesCollection* profiles); | |
129 virtual ~ProfilerEventsProcessor() {} | 130 virtual ~ProfilerEventsProcessor() {} |
130 | 131 |
131 // Thread control. | 132 // Thread control. |
132 virtual void Run(); | 133 virtual void Run(); |
133 inline void Stop() { running_ = false; } | 134 inline void Stop() { running_ = false; } |
134 INLINE(bool running()) { return running_; } | 135 INLINE(bool running()) { return running_; } |
135 | 136 |
136 // Events adding methods. Called by VM threads. | 137 // Events adding methods. Called by VM threads. |
137 void CallbackCreateEvent(Logger::LogEventsAndTags tag, | 138 void CallbackCreateEvent(Logger::LogEventsAndTags tag, |
138 const char* prefix, Name* name, | 139 const char* prefix, Name* name, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 #undef DECLARE_TYPE | 172 #undef DECLARE_TYPE |
172 }; | 173 }; |
173 | 174 |
174 // Called from events processing thread (Run() method.) | 175 // Called from events processing thread (Run() method.) |
175 bool ProcessCodeEvent(unsigned* dequeue_order); | 176 bool ProcessCodeEvent(unsigned* dequeue_order); |
176 bool ProcessTicks(unsigned dequeue_order); | 177 bool ProcessTicks(unsigned dequeue_order); |
177 | 178 |
178 INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); | 179 INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); |
179 | 180 |
180 ProfileGenerator* generator_; | 181 ProfileGenerator* generator_; |
182 CpuProfilesCollection* profiles_; | |
181 bool running_; | 183 bool running_; |
182 UnboundQueue<CodeEventsContainer> events_buffer_; | 184 UnboundQueue<CodeEventsContainer> events_buffer_; |
183 SamplingCircularQueue ticks_buffer_; | 185 SamplingCircularQueue ticks_buffer_; |
184 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; | 186 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
185 unsigned enqueue_order_; | 187 unsigned enqueue_order_; |
186 }; | 188 }; |
187 | 189 |
188 | 190 |
189 #define PROFILE(IsolateGetter, Call) \ | 191 #define PROFILE(IsolateGetter, Call) \ |
190 do { \ | 192 do { \ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 bool is_profiling_; | 262 bool is_profiling_; |
261 | 263 |
262 private: | 264 private: |
263 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 265 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
264 }; | 266 }; |
265 | 267 |
266 } } // namespace v8::internal | 268 } } // namespace v8::internal |
267 | 269 |
268 | 270 |
269 #endif // V8_CPU_PROFILER_H_ | 271 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |