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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Puts current stack into tick sample events buffer. | 151 // Puts current stack into tick sample events buffer. |
152 void AddCurrentStack(Isolate* isolate); | 152 void AddCurrentStack(Isolate* isolate); |
153 | 153 |
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 // SamplingCircularQueue has stricter alignment requirements than a normal new |
| 162 // can fulfil, so we need to provide our own new/delete here. |
| 163 void* operator new(size_t size); |
| 164 void operator delete(void* ptr); |
| 165 |
161 private: | 166 private: |
162 // Called from events processing thread (Run() method.) | 167 // Called from events processing thread (Run() method.) |
163 bool ProcessCodeEvent(); | 168 bool ProcessCodeEvent(); |
164 | 169 |
165 enum SampleProcessingResult { | 170 enum SampleProcessingResult { |
166 OneSampleProcessed, | 171 OneSampleProcessed, |
167 FoundSampleForNextCodeEvent, | 172 FoundSampleForNextCodeEvent, |
168 NoSamplesInQueue | 173 NoSamplesInQueue |
169 }; | 174 }; |
170 SampleProcessingResult ProcessOneSample(); | 175 SampleProcessingResult ProcessOneSample(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bool saved_is_logging_; | 278 bool saved_is_logging_; |
274 bool is_profiling_; | 279 bool is_profiling_; |
275 | 280 |
276 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 281 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
277 }; | 282 }; |
278 | 283 |
279 } } // namespace v8::internal | 284 } } // namespace v8::internal |
280 | 285 |
281 | 286 |
282 #endif // V8_CPU_PROFILER_H_ | 287 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |