| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROFILER_CPU_PROFILER_H_ | 5 #ifndef V8_PROFILER_CPU_PROFILER_H_ |
| 6 #define V8_PROFILER_CPU_PROFILER_H_ | 6 #define V8_PROFILER_CPU_PROFILER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/atomic-utils.h" |
| 9 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| 10 #include "src/base/platform/time.h" | 11 #include "src/base/platform/time.h" |
| 11 #include "src/compiler.h" | 12 #include "src/compiler.h" |
| 13 #include "src/locked-queue.h" |
| 12 #include "src/profiler/circular-queue.h" | 14 #include "src/profiler/circular-queue.h" |
| 13 #include "src/profiler/sampler.h" | 15 #include "src/profiler/sampler.h" |
| 14 #include "src/profiler/unbound-queue.h" | |
| 15 | 16 |
| 16 namespace v8 { | 17 namespace v8 { |
| 17 namespace internal { | 18 namespace internal { |
| 18 | 19 |
| 19 // Forward declarations. | 20 // Forward declarations. |
| 20 class CodeEntry; | 21 class CodeEntry; |
| 21 class CodeMap; | 22 class CodeMap; |
| 22 class CompilationInfo; | 23 class CompilationInfo; |
| 23 class CpuProfile; | 24 class CpuProfile; |
| 24 class CpuProfilesCollection; | 25 class CpuProfilesCollection; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 FoundSampleForNextCodeEvent, | 163 FoundSampleForNextCodeEvent, |
| 163 NoSamplesInQueue | 164 NoSamplesInQueue |
| 164 }; | 165 }; |
| 165 SampleProcessingResult ProcessOneSample(); | 166 SampleProcessingResult ProcessOneSample(); |
| 166 | 167 |
| 167 ProfileGenerator* generator_; | 168 ProfileGenerator* generator_; |
| 168 Sampler* sampler_; | 169 Sampler* sampler_; |
| 169 base::Atomic32 running_; | 170 base::Atomic32 running_; |
| 170 // Sampling period in microseconds. | 171 // Sampling period in microseconds. |
| 171 const base::TimeDelta period_; | 172 const base::TimeDelta period_; |
| 172 UnboundQueue<CodeEventsContainer> events_buffer_; | 173 LockedQueue<CodeEventsContainer> events_buffer_; |
| 173 static const size_t kTickSampleBufferSize = 1 * MB; | 174 static const size_t kTickSampleBufferSize = 1 * MB; |
| 174 static const size_t kTickSampleQueueLength = | 175 static const size_t kTickSampleQueueLength = |
| 175 kTickSampleBufferSize / sizeof(TickSampleEventRecord); | 176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); |
| 176 SamplingCircularQueue<TickSampleEventRecord, | 177 SamplingCircularQueue<TickSampleEventRecord, |
| 177 kTickSampleQueueLength> ticks_buffer_; | 178 kTickSampleQueueLength> ticks_buffer_; |
| 178 UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_; | 179 LockedQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
| 179 unsigned last_code_event_id_; | 180 AtomicNumber<unsigned> last_code_event_id_; |
| 180 unsigned last_processed_code_event_id_; | 181 unsigned last_processed_code_event_id_; |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 | 184 |
| 184 #define PROFILE(IsolateGetter, Call) \ | 185 #define PROFILE(IsolateGetter, Call) \ |
| 185 do { \ | 186 do { \ |
| 186 Isolate* cpu_profiler_isolate = (IsolateGetter); \ | 187 Isolate* cpu_profiler_isolate = (IsolateGetter); \ |
| 187 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \ | 188 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \ |
| 188 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ | 189 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ |
| 189 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \ | 190 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \ |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 bool is_profiling_; | 269 bool is_profiling_; |
| 269 | 270 |
| 270 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 271 }; | 272 }; |
| 272 | 273 |
| 273 } // namespace internal | 274 } // namespace internal |
| 274 } // namespace v8 | 275 } // namespace v8 |
| 275 | 276 |
| 276 | 277 |
| 277 #endif // V8_PROFILER_CPU_PROFILER_H_ | 278 #endif // V8_PROFILER_CPU_PROFILER_H_ |
| OLD | NEW |