Chromium Code Reviews| Index: src/cpu-profiler.h |
| diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h |
| index 455c89332870caa7a2a87107d77890309e951057..becefd10c4845dad0fef4c7d95b7257eff816803 100644 |
| --- a/src/cpu-profiler.h |
| +++ b/src/cpu-profiler.h |
| @@ -122,6 +122,21 @@ class TickSampleEventRecord { |
| }; |
| +class CodeEventsContainer { |
| + public: |
| + explicit CodeEventsContainer( |
| + CodeEventRecord::Type type = CodeEventRecord::NONE) { |
| + generic.type = type; |
| + } |
| + union { |
| + CodeEventRecord generic; |
| +#define DECLARE_CLASS(ignore, type) type type##_; |
| + CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) |
| +#undef DECLARE_TYPE |
| + }; |
| +}; |
| + |
| + |
| // This class implements both the profile events processor thread and |
| // methods called by event producers: VM and stack sampler threads. |
| class ProfilerEventsProcessor : public Thread { |
| @@ -134,29 +149,12 @@ class ProfilerEventsProcessor : public Thread { |
| virtual void Run(); |
| inline void Stop() { running_ = false; } |
| INLINE(bool running()) { return running_; } |
|
yurys
2013/06/28 11:33:43
I don't see much sense in marking these methods in
loislo
2013/06/28 12:33:12
Done.
|
| + INLINE(void Enqueue(CodeEventsContainer* event)); |
| - // Events adding methods. Called by VM threads. |
| - void CallbackCreateEvent(Logger::LogEventsAndTags tag, |
| - const char* prefix, Name* name, |
| - Address start); |
| - void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Name* name, |
| - String* resource_name, int line_number, |
| - Address start, unsigned size, |
| - Address shared, |
| - CompilationInfo* info); |
| - void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - const char* name, |
| - Address start, unsigned size); |
| - void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - int args_count, |
| - Address start, unsigned size); |
| +// Events adding methods. Called by VM threads. |
| void CodeMoveEvent(Address from, Address to); |
| void CodeDeleteEvent(Address from); |
| void SharedFunctionInfoMoveEvent(Address from, Address to); |
| - void RegExpCodeCreateEvent(Logger::LogEventsAndTags tag, |
| - const char* prefix, String* name, |
| - Address start, unsigned size); |
| // Puts current stack into tick sample events buffer. |
| void AddCurrentStack(); |
| @@ -167,19 +165,10 @@ class ProfilerEventsProcessor : public Thread { |
| INLINE(TickSample* TickSampleEvent()); |
| private: |
| - union CodeEventsContainer { |
| - CodeEventRecord generic; |
| -#define DECLARE_CLASS(ignore, type) type type##_; |
| - CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) |
| -#undef DECLARE_TYPE |
| - }; |
| - |
| // Called from events processing thread (Run() method.) |
| bool ProcessCodeEvent(unsigned* dequeue_order); |
| bool ProcessTicks(unsigned dequeue_order); |
| - INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); |
| - |
| ProfileGenerator* generator_; |
| CpuProfilesCollection* profiles_; |
| bool running_; |
| @@ -204,6 +193,12 @@ class ProfilerEventsProcessor : public Thread { |
| class CpuProfiler { |
| public: |
| explicit CpuProfiler(Isolate* isolate); |
| + |
| + CpuProfiler(Isolate* isolate, |
| + CpuProfilesCollection* test_collection, |
| + ProfileGenerator* test_generator, |
| + ProfilerEventsProcessor* test_processor); |
| + |
| ~CpuProfiler(); |
| void StartProfiling(const char* title, bool record_samples = false); |
| @@ -253,6 +248,8 @@ class CpuProfiler { |
| } |
| private: |
| + INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); |
|
yurys
2013/06/28 11:33:43
I'd rather make it a static function in cpu-profi
loislo
2013/06/28 12:33:12
Done.
|
| + |
| void StartProcessorIfNotStarted(); |
| void StopProcessorIfLastProfile(const char* title); |
| void StopProcessor(); |