| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROFILER_CPU_PROFILER_H_ | 5 #ifndef V8_PROFILER_CPU_PROFILER_H_ |
| 6 #define V8_PROFILER_CPU_PROFILER_H_ | 6 #define V8_PROFILER_CPU_PROFILER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
| 10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 class CpuProfiler : public CodeEventListener { | 195 class CpuProfiler : public CodeEventListener { |
| 196 public: | 196 public: |
| 197 explicit CpuProfiler(Isolate* isolate); | 197 explicit CpuProfiler(Isolate* isolate); |
| 198 | 198 |
| 199 CpuProfiler(Isolate* isolate, | 199 CpuProfiler(Isolate* isolate, |
| 200 CpuProfilesCollection* test_collection, | 200 CpuProfilesCollection* test_collection, |
| 201 ProfileGenerator* test_generator, | 201 ProfileGenerator* test_generator, |
| 202 ProfilerEventsProcessor* test_processor); | 202 ProfilerEventsProcessor* test_processor); |
| 203 | 203 |
| 204 virtual ~CpuProfiler(); | 204 ~CpuProfiler() override; |
| 205 | 205 |
| 206 void set_sampling_interval(base::TimeDelta value); | 206 void set_sampling_interval(base::TimeDelta value); |
| 207 void CollectSample(); | 207 void CollectSample(); |
| 208 void StartProfiling(const char* title, bool record_samples = false); | 208 void StartProfiling(const char* title, bool record_samples = false); |
| 209 void StartProfiling(String* title, bool record_samples); | 209 void StartProfiling(String* title, bool record_samples); |
| 210 CpuProfile* StopProfiling(const char* title); | 210 CpuProfile* StopProfiling(const char* title); |
| 211 CpuProfile* StopProfiling(String* title); | 211 CpuProfile* StopProfiling(String* title); |
| 212 int GetProfilesCount(); | 212 int GetProfilesCount(); |
| 213 CpuProfile* GetProfile(int index); | 213 CpuProfile* GetProfile(int index); |
| 214 void DeleteAllProfiles(); | 214 void DeleteAllProfiles(); |
| 215 void DeleteProfile(CpuProfile* profile); | 215 void DeleteProfile(CpuProfile* profile); |
| 216 | 216 |
| 217 // Invoked from stack sampler (thread or signal handler.) | 217 // Invoked from stack sampler (thread or signal handler.) |
| 218 inline TickSample* StartTickSample(); | 218 inline TickSample* StartTickSample(); |
| 219 inline void FinishTickSample(); | 219 inline void FinishTickSample(); |
| 220 | 220 |
| 221 // Must be called via PROFILE macro, otherwise will crash when | 221 // Must be called via PROFILE macro, otherwise will crash when |
| 222 // profiling is not enabled. | 222 // profiling is not enabled. |
| 223 virtual void CallbackEvent(Name* name, Address entry_point); | 223 void CallbackEvent(Name* name, Address entry_point) override; |
| 224 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 224 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
| 225 Code* code, const char* comment); | 225 const char* comment) override; |
| 226 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 226 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
| 227 Code* code, Name* name); | 227 Name* name) override; |
| 228 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, | 228 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
| 229 SharedFunctionInfo* shared, | 229 SharedFunctionInfo* shared, CompilationInfo* info, |
| 230 CompilationInfo* info, Name* script_name); | 230 Name* script_name) override; |
| 231 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, | 231 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
| 232 SharedFunctionInfo* shared, | 232 SharedFunctionInfo* shared, CompilationInfo* info, |
| 233 CompilationInfo* info, Name* script_name, | 233 Name* script_name, int line, int column) override; |
| 234 int line, int column); | 234 void CodeCreateEvent(Logger::LogEventsAndTags tag, AbstractCode* code, |
| 235 virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, | 235 int args_count) override; |
| 236 Code* code, int args_count); | 236 void CodeMovingGCEvent() override {} |
| 237 virtual void CodeMovingGCEvent() {} | 237 void CodeMoveEvent(AbstractCode* from, Address to) override; |
| 238 virtual void CodeMoveEvent(Address from, Address to); | 238 void CodeDisableOptEvent(AbstractCode* code, |
| 239 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared); | 239 SharedFunctionInfo* shared) override; |
| 240 virtual void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); | 240 void CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta); |
| 241 virtual void CodeDeleteEvent(Address from); | 241 void GetterCallbackEvent(Name* name, Address entry_point) override; |
| 242 virtual void GetterCallbackEvent(Name* name, Address entry_point); | 242 void RegExpCodeCreateEvent(AbstractCode* code, String* source) override; |
| 243 virtual void RegExpCodeCreateEvent(Code* code, String* source); | 243 void SetterCallbackEvent(Name* name, Address entry_point) override; |
| 244 virtual void SetterCallbackEvent(Name* name, Address entry_point); | 244 void SharedFunctionInfoMoveEvent(Address from, Address to) override {} |
| 245 virtual void SharedFunctionInfoMoveEvent(Address from, Address to) {} | |
| 246 | 245 |
| 247 INLINE(bool is_profiling() const) { return is_profiling_; } | 246 INLINE(bool is_profiling() const) { return is_profiling_; } |
| 248 bool* is_profiling_address() { | 247 bool* is_profiling_address() { |
| 249 return &is_profiling_; | 248 return &is_profiling_; |
| 250 } | 249 } |
| 251 | 250 |
| 252 ProfileGenerator* generator() const { return generator_; } | 251 ProfileGenerator* generator() const { return generator_; } |
| 253 ProfilerEventsProcessor* processor() const { return processor_; } | 252 ProfilerEventsProcessor* processor() const { return processor_; } |
| 254 Isolate* isolate() const { return isolate_; } | 253 Isolate* isolate() const { return isolate_; } |
| 255 | 254 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 269 bool is_profiling_; | 268 bool is_profiling_; |
| 270 | 269 |
| 271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 270 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 272 }; | 271 }; |
| 273 | 272 |
| 274 } // namespace internal | 273 } // namespace internal |
| 275 } // namespace v8 | 274 } // namespace v8 |
| 276 | 275 |
| 277 | 276 |
| 278 #endif // V8_PROFILER_CPU_PROFILER_H_ | 277 #endif // V8_PROFILER_CPU_PROFILER_H_ |
| OLD | NEW |