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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 }; | 131 }; |
132 }; | 132 }; |
133 | 133 |
134 | 134 |
135 // This class implements both the profile events processor thread and | 135 // This class implements both the profile events processor thread and |
136 // methods called by event producers: VM and stack sampler threads. | 136 // methods called by event producers: VM and stack sampler threads. |
137 class ProfilerEventsProcessor : public Thread { | 137 class ProfilerEventsProcessor : public Thread { |
138 public: | 138 public: |
139 ProfilerEventsProcessor(ProfileGenerator* generator, | 139 ProfilerEventsProcessor(ProfileGenerator* generator, |
140 Sampler* sampler, | 140 Sampler* sampler, |
141 int period_in_useconds); | 141 TimeDelta period); |
142 virtual ~ProfilerEventsProcessor() {} | 142 virtual ~ProfilerEventsProcessor() {} |
143 | 143 |
144 // Thread control. | 144 // Thread control. |
145 virtual void Run(); | 145 virtual void Run(); |
146 void StopSynchronously(); | 146 void StopSynchronously(); |
147 INLINE(bool running()) { return running_; } | 147 INLINE(bool running()) { return running_; } |
148 void Enqueue(const CodeEventsContainer& event); | 148 void Enqueue(const CodeEventsContainer& event); |
149 | 149 |
150 // Puts current stack into tick sample events buffer. | 150 // Puts current stack into tick sample events buffer. |
151 void AddCurrentStack(Isolate* isolate); | 151 void AddCurrentStack(Isolate* isolate); |
(...skipping 10 matching lines...) Expand all Loading... |
162 bool ProcessCodeEvent(); | 162 bool ProcessCodeEvent(); |
163 bool ProcessTicks(); | 163 bool ProcessTicks(); |
164 | 164 |
165 void ProcessEventsAndDoSample(); | 165 void ProcessEventsAndDoSample(); |
166 void ProcessEventsAndYield(); | 166 void ProcessEventsAndYield(); |
167 | 167 |
168 ProfileGenerator* generator_; | 168 ProfileGenerator* generator_; |
169 Sampler* sampler_; | 169 Sampler* sampler_; |
170 bool running_; | 170 bool running_; |
171 // Sampling period in microseconds. | 171 // Sampling period in microseconds. |
172 const int period_in_useconds_; | 172 const TimeDelta period_; |
173 UnboundQueue<CodeEventsContainer> events_buffer_; | 173 UnboundQueue<CodeEventsContainer> events_buffer_; |
174 static const size_t kTickSampleBufferSize = 1 * MB; | 174 static const size_t kTickSampleBufferSize = 1 * MB; |
175 static const size_t kTickSampleQueueLength = | 175 static const size_t kTickSampleQueueLength = |
176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); | 176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); |
177 SamplingCircularQueue<TickSampleEventRecord, | 177 SamplingCircularQueue<TickSampleEventRecord, |
178 kTickSampleQueueLength> ticks_buffer_; | 178 kTickSampleQueueLength> ticks_buffer_; |
179 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; | 179 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
180 unsigned last_code_event_id_; | 180 unsigned last_code_event_id_; |
181 unsigned last_processed_code_event_id_; | 181 unsigned last_processed_code_event_id_; |
182 }; | 182 }; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 bool need_to_stop_sampler_; | 269 bool need_to_stop_sampler_; |
270 bool is_profiling_; | 270 bool is_profiling_; |
271 | 271 |
272 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 272 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
273 }; | 273 }; |
274 | 274 |
275 } } // namespace v8::internal | 275 } } // namespace v8::internal |
276 | 276 |
277 | 277 |
278 #endif // V8_CPU_PROFILER_H_ | 278 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |