| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 static void TearDown(); | 220 static void TearDown(); |
| 221 | 221 |
| 222 #ifdef ENABLE_LOGGING_AND_PROFILING | 222 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 223 static void StartProfiling(const char* title); | 223 static void StartProfiling(const char* title); |
| 224 static void StartProfiling(String* title); | 224 static void StartProfiling(String* title); |
| 225 static CpuProfile* StopProfiling(const char* title); | 225 static CpuProfile* StopProfiling(const char* title); |
| 226 static CpuProfile* StopProfiling(Object* security_token, String* title); | 226 static CpuProfile* StopProfiling(Object* security_token, String* title); |
| 227 static int GetProfilesCount(); | 227 static int GetProfilesCount(); |
| 228 static CpuProfile* GetProfile(Object* security_token, int index); | 228 static CpuProfile* GetProfile(Object* security_token, int index); |
| 229 static CpuProfile* FindProfile(Object* security_token, unsigned uid); | 229 static CpuProfile* FindProfile(Object* security_token, unsigned uid); |
| 230 static void DeleteAllProfiles(); |
| 231 static void DeleteProfile(CpuProfile* profile); |
| 232 static bool HasDetachedProfiles(); |
| 230 | 233 |
| 231 // Invoked from stack sampler (thread or signal handler.) | 234 // Invoked from stack sampler (thread or signal handler.) |
| 232 static TickSample* TickSampleEvent(Isolate* isolate); | 235 static TickSample* TickSampleEvent(Isolate* isolate); |
| 233 | 236 |
| 234 // Must be called via PROFILE macro, otherwise will crash when | 237 // Must be called via PROFILE macro, otherwise will crash when |
| 235 // profiling is not enabled. | 238 // profiling is not enabled. |
| 236 static void CallbackEvent(String* name, Address entry_point); | 239 static void CallbackEvent(String* name, Address entry_point); |
| 237 static void CodeCreateEvent(Logger::LogEventsAndTags tag, | 240 static void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 238 Code* code, const char* comment); | 241 Code* code, const char* comment); |
| 239 static void CodeCreateEvent(Logger::LogEventsAndTags tag, | 242 static void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 269 | 272 |
| 270 private: | 273 private: |
| 271 CpuProfiler(); | 274 CpuProfiler(); |
| 272 ~CpuProfiler(); | 275 ~CpuProfiler(); |
| 273 void StartCollectingProfile(const char* title); | 276 void StartCollectingProfile(const char* title); |
| 274 void StartCollectingProfile(String* title); | 277 void StartCollectingProfile(String* title); |
| 275 void StartProcessorIfNotStarted(); | 278 void StartProcessorIfNotStarted(); |
| 276 CpuProfile* StopCollectingProfile(const char* title); | 279 CpuProfile* StopCollectingProfile(const char* title); |
| 277 CpuProfile* StopCollectingProfile(Object* security_token, String* title); | 280 CpuProfile* StopCollectingProfile(Object* security_token, String* title); |
| 278 void StopProcessorIfLastProfile(const char* title); | 281 void StopProcessorIfLastProfile(const char* title); |
| 282 void StopProcessor(); |
| 283 void ResetProfiles(); |
| 279 | 284 |
| 280 CpuProfilesCollection* profiles_; | 285 CpuProfilesCollection* profiles_; |
| 281 unsigned next_profile_uid_; | 286 unsigned next_profile_uid_; |
| 282 TokenEnumerator* token_enumerator_; | 287 TokenEnumerator* token_enumerator_; |
| 283 ProfileGenerator* generator_; | 288 ProfileGenerator* generator_; |
| 284 ProfilerEventsProcessor* processor_; | 289 ProfilerEventsProcessor* processor_; |
| 285 int saved_logging_nesting_; | 290 int saved_logging_nesting_; |
| 286 bool need_to_stop_sampler_; | 291 bool need_to_stop_sampler_; |
| 287 Atomic32 is_profiling_; | 292 Atomic32 is_profiling_; |
| 288 | 293 |
| 289 #else | 294 #else |
| 290 static INLINE(bool is_profiling()) { return false; } | 295 static INLINE(bool is_profiling()) { return false; } |
| 291 #endif // ENABLE_LOGGING_AND_PROFILING | 296 #endif // ENABLE_LOGGING_AND_PROFILING |
| 292 | 297 |
| 293 private: | 298 private: |
| 294 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 299 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 295 }; | 300 }; |
| 296 | 301 |
| 297 } } // namespace v8::internal | 302 } } // namespace v8::internal |
| 298 | 303 |
| 299 | 304 |
| 300 #endif // V8_CPU_PROFILER_H_ | 305 #endif // V8_CPU_PROFILER_H_ |
| OLD | NEW |