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 ProcessTicks(); | |
165 | 164 |
166 void ProcessEventsAndDoSample(); | 165 enum SampleProcessingResult { |
| 166 OneSampleProcessed, |
| 167 FoundSampleForNextCodeEvent, |
| 168 NoSamplesInQueue |
| 169 }; |
| 170 SampleProcessingResult ProcessOneSample(); |
167 | 171 |
168 ProfileGenerator* generator_; | 172 ProfileGenerator* generator_; |
169 Sampler* sampler_; | 173 Sampler* sampler_; |
170 bool running_; | 174 bool running_; |
171 // Sampling period in microseconds. | 175 // Sampling period in microseconds. |
172 const TimeDelta period_; | 176 const TimeDelta period_; |
173 UnboundQueue<CodeEventsContainer> events_buffer_; | 177 UnboundQueue<CodeEventsContainer> events_buffer_; |
174 static const size_t kTickSampleBufferSize = 1 * MB; | 178 static const size_t kTickSampleBufferSize = 1 * MB; |
175 static const size_t kTickSampleQueueLength = | 179 static const size_t kTickSampleQueueLength = |
176 kTickSampleBufferSize / sizeof(TickSampleEventRecord); | 180 kTickSampleBufferSize / sizeof(TickSampleEventRecord); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 bool saved_is_logging_; | 274 bool saved_is_logging_; |
271 bool is_profiling_; | 275 bool is_profiling_; |
272 | 276 |
273 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 277 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
274 }; | 278 }; |
275 | 279 |
276 } } // namespace v8::internal | 280 } } // namespace v8::internal |
277 | 281 |
278 | 282 |
279 #endif // V8_CPU_PROFILER_H_ | 283 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |