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