| 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/atomic-utils.h" |
| 10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| 11 #include "src/base/platform/time.h" | 11 #include "src/base/platform/time.h" |
| 12 #include "src/compiler.h" | 12 #include "src/compiler.h" |
| 13 #include "src/locked-queue.h" | 13 #include "src/locked-queue.h" |
| 14 #include "src/profiler/circular-queue.h" | 14 #include "src/profiler/circular-queue.h" |
| 15 #include "src/profiler/sampler.h" | 15 #include "src/profiler/sampler.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 Sampler* sampler_; | 169 Sampler* sampler_; |
| 170 base::Atomic32 running_; | 170 base::Atomic32 running_; |
| 171 const base::TimeDelta period_; // Samples & code events processing period. | 171 const base::TimeDelta period_; // Samples & code events processing period. |
| 172 LockedQueue<CodeEventsContainer> events_buffer_; | 172 LockedQueue<CodeEventsContainer> events_buffer_; |
| 173 static const size_t kTickSampleBufferSize = 1 * MB; | 173 static const size_t kTickSampleBufferSize = 1 * MB; |
| 174 static const size_t kTickSampleQueueLength = | 174 static const size_t kTickSampleQueueLength = |
| 175 kTickSampleBufferSize / sizeof(TickSampleEventRecord); | 175 kTickSampleBufferSize / sizeof(TickSampleEventRecord); |
| 176 SamplingCircularQueue<TickSampleEventRecord, | 176 SamplingCircularQueue<TickSampleEventRecord, |
| 177 kTickSampleQueueLength> ticks_buffer_; | 177 kTickSampleQueueLength> ticks_buffer_; |
| 178 LockedQueue<TickSampleEventRecord> ticks_from_vm_buffer_; | 178 LockedQueue<TickSampleEventRecord> ticks_from_vm_buffer_; |
| 179 AtomicNumber<unsigned> last_code_event_id_; | 179 base::AtomicNumber<unsigned> last_code_event_id_; |
| 180 unsigned last_processed_code_event_id_; | 180 unsigned last_processed_code_event_id_; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 | 183 |
| 184 #define PROFILE(IsolateGetter, Call) \ | 184 #define PROFILE(IsolateGetter, Call) \ |
| 185 do { \ | 185 do { \ |
| 186 Isolate* cpu_profiler_isolate = (IsolateGetter); \ | 186 Isolate* cpu_profiler_isolate = (IsolateGetter); \ |
| 187 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \ | 187 v8::internal::Logger* logger = cpu_profiler_isolate->logger(); \ |
| 188 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ | 188 CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \ |
| 189 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \ | 189 if (logger->is_logging_code_events() || cpu_profiler->is_profiling()) { \ |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool is_profiling_; | 269 bool is_profiling_; |
| 270 | 270 |
| 271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 272 }; | 272 }; |
| 273 | 273 |
| 274 } // namespace internal | 274 } // namespace internal |
| 275 } // namespace v8 | 275 } // namespace v8 |
| 276 | 276 |
| 277 | 277 |
| 278 #endif // V8_PROFILER_CPU_PROFILER_H_ | 278 #endif // V8_PROFILER_CPU_PROFILER_H_ |
| OLD | NEW |