| Index: src/cpu-profiler.h
|
| diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h
|
| index 9cd44842095ccabe25d0ef74f0c0f0b53dde958d..f4bc0c7c74c704d08831d113be99f574af0679ff 100644
|
| --- a/src/cpu-profiler.h
|
| +++ b/src/cpu-profiler.h
|
| @@ -124,7 +124,9 @@ class TickSampleEventRecord {
|
| // methods called by event producers: VM and stack sampler threads.
|
| class ProfilerEventsProcessor : public Thread {
|
| public:
|
| - explicit ProfilerEventsProcessor(ProfileGenerator* generator);
|
| + explicit ProfilerEventsProcessor(ProfileGenerator* generator,
|
| + Sampler* sampler,
|
| + int period_in_useconds);
|
| virtual ~ProfilerEventsProcessor() {}
|
|
|
| // Thread control.
|
| @@ -156,11 +158,12 @@ class ProfilerEventsProcessor : public Thread {
|
| // Puts current stack into tick sample events buffer.
|
| void AddCurrentStack();
|
|
|
| - // Tick sample events are filled directly in the buffer of the circular
|
| - // queue (because the structure is of fixed width, but usually not all
|
| - // stack frame entries are filled.) This method returns a pointer to the
|
| - // next record of the buffer.
|
| - INLINE(TickSample* TickSampleEvent());
|
| + // StartTickSampleEvent returns a pointer only if the ticks_buffer_ is empty,
|
| + // FinishTickSampleEvent marks the ticks_buffer_ as filled.
|
| + // Finish should be called only after successful Start (returning non-NULL
|
| + // pointer).
|
| + INLINE(TickSample* StartTickSampleEvent());
|
| + INLINE(void FinishTickSampleEvent());
|
|
|
| private:
|
| union CodeEventsContainer {
|
| @@ -173,13 +176,19 @@ class ProfilerEventsProcessor : public Thread {
|
| // Called from events processing thread (Run() method.)
|
| bool ProcessCodeEvent(unsigned* dequeue_order);
|
| bool ProcessTicks(unsigned dequeue_order);
|
| + void ProcessEventsQueue(int64_t stop_time, unsigned* dequeue_order);
|
|
|
| INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag));
|
|
|
| ProfileGenerator* generator_;
|
| + Sampler* sampler_;
|
| bool running_;
|
| + // Sampling period in microseconds.
|
| + const int period_in_useconds_;
|
| UnboundQueue<CodeEventsContainer> events_buffer_;
|
| - SamplingCircularQueue ticks_buffer_;
|
| + TickSampleEventRecord ticks_buffer_;
|
| + bool ticks_buffer_is_empty_;
|
| + bool ticks_buffer_is_initialized_;
|
| UnboundQueue<TickSampleEventRecord> ticks_from_vm_buffer_;
|
| unsigned enqueue_order_;
|
| };
|
| @@ -218,7 +227,10 @@ class CpuProfiler {
|
| static bool HasDetachedProfiles();
|
|
|
| // Invoked from stack sampler (thread or signal handler.)
|
| - static TickSample* TickSampleEvent(Isolate* isolate);
|
| + // Finish should be called only after successful Start (returning non-NULL
|
| + // pointer).
|
| + static TickSample* StartTickSampleEvent(Isolate* isolate);
|
| + static void FinishTickSampleEvent(Isolate* isolate);
|
|
|
| // Must be called via PROFILE macro, otherwise will crash when
|
| // profiling is not enabled.
|
|
|