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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // Tick sample events are filled directly in the buffer of the circular | 154 // Tick sample events are filled directly in the buffer of the circular |
155 // queue (because the structure is of fixed width, but usually not all | 155 // queue (because the structure is of fixed width, but usually not all |
156 // stack frame entries are filled.) This method returns a pointer to the | 156 // stack frame entries are filled.) This method returns a pointer to the |
157 // next record of the buffer. | 157 // next record of the buffer. |
158 inline TickSample* StartTickSample(); | 158 inline TickSample* StartTickSample(); |
159 inline void FinishTickSample(); | 159 inline void FinishTickSample(); |
160 | 160 |
161 private: | 161 private: |
162 // Called from events processing thread (Run() method.) | 162 // Called from events processing thread (Run() method.) |
163 bool ProcessCodeEvent(); | 163 bool ProcessCodeEvent(); |
164 bool ProcessOneSample(); | 164 bool ProcessTicks(); |
| 165 |
| 166 void ProcessEventsAndDoSample(); |
165 | 167 |
166 ProfileGenerator* generator_; | 168 ProfileGenerator* generator_; |
167 Sampler* sampler_; | 169 Sampler* sampler_; |
168 bool running_; | 170 bool running_; |
169 // Sampling period in microseconds. | 171 // Sampling period in microseconds. |
170 const TimeDelta period_; | 172 const TimeDelta period_; |
171 UnboundQueue<CodeEventsContainer> events_buffer_; | 173 UnboundQueue<CodeEventsContainer> events_buffer_; |
172 static const size_t kTickSampleBufferSize = 1 * MB; | 174 static const size_t kTickSampleBufferSize = 1 * MB; |
173 static const size_t kTickSampleQueueLength = | 175 static const size_t kTickSampleQueueLength = |
174 kTickSampleBufferSize / sizeof(TickSampleEventRecord); | 176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 bool saved_is_logging_; | 270 bool saved_is_logging_; |
269 bool is_profiling_; | 271 bool is_profiling_; |
270 | 272 |
271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 273 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
272 }; | 274 }; |
273 | 275 |
274 } } // namespace v8::internal | 276 } } // namespace v8::internal |
275 | 277 |
276 | 278 |
277 #endif // V8_CPU_PROFILER_H_ | 279 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |