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 13 matching lines...) Expand all Loading... |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_CPU_PROFILER_H_ | 28 #ifndef V8_CPU_PROFILER_H_ |
29 #define V8_CPU_PROFILER_H_ | 29 #define V8_CPU_PROFILER_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "atomicops.h" | 32 #include "atomicops.h" |
33 #include "circular-queue.h" | 33 #include "circular-queue.h" |
| 34 #include "platform/time.h" |
34 #include "sampler.h" | 35 #include "sampler.h" |
35 #include "unbound-queue.h" | 36 #include "unbound-queue.h" |
36 | 37 |
37 namespace v8 { | 38 namespace v8 { |
38 namespace internal { | 39 namespace internal { |
39 | 40 |
40 // Forward declarations. | 41 // Forward declarations. |
41 class CodeEntry; | 42 class CodeEntry; |
42 class CodeMap; | 43 class CodeMap; |
43 class CompilationInfo; | 44 class CompilationInfo; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 public: | 197 public: |
197 explicit CpuProfiler(Isolate* isolate); | 198 explicit CpuProfiler(Isolate* isolate); |
198 | 199 |
199 CpuProfiler(Isolate* isolate, | 200 CpuProfiler(Isolate* isolate, |
200 CpuProfilesCollection* test_collection, | 201 CpuProfilesCollection* test_collection, |
201 ProfileGenerator* test_generator, | 202 ProfileGenerator* test_generator, |
202 ProfilerEventsProcessor* test_processor); | 203 ProfilerEventsProcessor* test_processor); |
203 | 204 |
204 virtual ~CpuProfiler(); | 205 virtual ~CpuProfiler(); |
205 | 206 |
| 207 void set_sampling_interval(TimeDelta value); |
206 void StartProfiling(const char* title, bool record_samples = false); | 208 void StartProfiling(const char* title, bool record_samples = false); |
207 void StartProfiling(String* title, bool record_samples); | 209 void StartProfiling(String* title, bool record_samples); |
208 CpuProfile* StopProfiling(const char* title); | 210 CpuProfile* StopProfiling(const char* title); |
209 CpuProfile* StopProfiling(String* title); | 211 CpuProfile* StopProfiling(String* title); |
210 int GetProfilesCount(); | 212 int GetProfilesCount(); |
211 CpuProfile* GetProfile(int index); | 213 CpuProfile* GetProfile(int index); |
212 void DeleteAllProfiles(); | 214 void DeleteAllProfiles(); |
213 void DeleteProfile(CpuProfile* profile); | 215 void DeleteProfile(CpuProfile* profile); |
214 | 216 |
215 // Invoked from stack sampler (thread or signal handler.) | 217 // Invoked from stack sampler (thread or signal handler.) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 Isolate* isolate() const { return isolate_; } | 255 Isolate* isolate() const { return isolate_; } |
254 | 256 |
255 private: | 257 private: |
256 void StartProcessorIfNotStarted(); | 258 void StartProcessorIfNotStarted(); |
257 void StopProcessorIfLastProfile(const char* title); | 259 void StopProcessorIfLastProfile(const char* title); |
258 void StopProcessor(); | 260 void StopProcessor(); |
259 void ResetProfiles(); | 261 void ResetProfiles(); |
260 void LogBuiltins(); | 262 void LogBuiltins(); |
261 | 263 |
262 Isolate* isolate_; | 264 Isolate* isolate_; |
| 265 TimeDelta sampling_interval_; |
263 CpuProfilesCollection* profiles_; | 266 CpuProfilesCollection* profiles_; |
264 unsigned next_profile_uid_; | 267 unsigned next_profile_uid_; |
265 ProfileGenerator* generator_; | 268 ProfileGenerator* generator_; |
266 ProfilerEventsProcessor* processor_; | 269 ProfilerEventsProcessor* processor_; |
267 bool saved_is_logging_; | 270 bool saved_is_logging_; |
268 bool is_profiling_; | 271 bool is_profiling_; |
269 | 272 |
270 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 273 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
271 }; | 274 }; |
272 | 275 |
273 } } // namespace v8::internal | 276 } } // namespace v8::internal |
274 | 277 |
275 | 278 |
276 #endif // V8_CPU_PROFILER_H_ | 279 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |