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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 namespace internal { | 200 namespace internal { |
201 | 201 |
202 | 202 |
203 // TODO(isolates): isolatify this class. | 203 // TODO(isolates): isolatify this class. |
204 class CpuProfiler { | 204 class CpuProfiler { |
205 public: | 205 public: |
206 static void SetUp(); | 206 static void SetUp(); |
207 static void TearDown(); | 207 static void TearDown(); |
208 | 208 |
209 static void StartProfiling(const char* title); | 209 static void StartProfiling(const char* title); |
210 static void StartProfiling(String* title); | 210 static void StartProfiling(String* title, bool record_samples); |
211 static CpuProfile* StopProfiling(const char* title); | 211 static CpuProfile* StopProfiling(const char* title); |
212 static CpuProfile* StopProfiling(Object* security_token, String* title); | 212 static CpuProfile* StopProfiling(Object* security_token, String* title); |
213 static int GetProfilesCount(); | 213 static int GetProfilesCount(); |
214 static CpuProfile* GetProfile(Object* security_token, int index); | 214 static CpuProfile* GetProfile(Object* security_token, int index); |
215 static CpuProfile* FindProfile(Object* security_token, unsigned uid); | 215 static CpuProfile* FindProfile(Object* security_token, unsigned uid); |
216 static void DeleteAllProfiles(); | 216 static void DeleteAllProfiles(); |
217 static void DeleteProfile(CpuProfile* profile); | 217 static void DeleteProfile(CpuProfile* profile); |
218 static bool HasDetachedProfiles(); | 218 static bool HasDetachedProfiles(); |
219 | 219 |
220 // Invoked from stack sampler (thread or signal handler.) | 220 // Invoked from stack sampler (thread or signal handler.) |
(...skipping 25 matching lines...) Expand all Loading... |
246 static void SharedFunctionInfoMoveEvent(Address from, Address to); | 246 static void SharedFunctionInfoMoveEvent(Address from, Address to); |
247 | 247 |
248 static INLINE(bool is_profiling(Isolate* isolate)) { | 248 static INLINE(bool is_profiling(Isolate* isolate)) { |
249 CpuProfiler* profiler = isolate->cpu_profiler(); | 249 CpuProfiler* profiler = isolate->cpu_profiler(); |
250 return profiler != NULL && profiler->is_profiling_; | 250 return profiler != NULL && profiler->is_profiling_; |
251 } | 251 } |
252 | 252 |
253 private: | 253 private: |
254 CpuProfiler(); | 254 CpuProfiler(); |
255 ~CpuProfiler(); | 255 ~CpuProfiler(); |
256 void StartCollectingProfile(const char* title); | 256 void StartCollectingProfile(const char* title, bool record_samples); |
257 void StartCollectingProfile(String* title); | 257 void StartCollectingProfile(String* title, bool record_samples); |
258 void StartProcessorIfNotStarted(); | 258 void StartProcessorIfNotStarted(); |
259 CpuProfile* StopCollectingProfile(const char* title); | 259 CpuProfile* StopCollectingProfile(const char* title); |
260 CpuProfile* StopCollectingProfile(Object* security_token, String* title); | 260 CpuProfile* StopCollectingProfile(Object* security_token, String* title); |
261 void StopProcessorIfLastProfile(const char* title); | 261 void StopProcessorIfLastProfile(const char* title); |
262 void StopProcessor(); | 262 void StopProcessor(); |
263 void ResetProfiles(); | 263 void ResetProfiles(); |
264 | 264 |
265 CpuProfilesCollection* profiles_; | 265 CpuProfilesCollection* profiles_; |
266 unsigned next_profile_uid_; | 266 unsigned next_profile_uid_; |
267 TokenEnumerator* token_enumerator_; | 267 TokenEnumerator* token_enumerator_; |
268 ProfileGenerator* generator_; | 268 ProfileGenerator* generator_; |
269 ProfilerEventsProcessor* processor_; | 269 ProfilerEventsProcessor* processor_; |
270 int saved_logging_nesting_; | 270 int saved_logging_nesting_; |
271 bool need_to_stop_sampler_; | 271 bool need_to_stop_sampler_; |
272 bool is_profiling_; | 272 bool is_profiling_; |
273 | 273 |
274 private: | 274 private: |
275 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 275 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
276 }; | 276 }; |
277 | 277 |
278 } } // namespace v8::internal | 278 } } // namespace v8::internal |
279 | 279 |
280 | 280 |
281 #endif // V8_CPU_PROFILER_H_ | 281 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |