Chromium Code Reviews| Index: runtime/vm/profiler.h |
| diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h |
| index 1e7c52701b54003e91c3bb518bbc986a9ce0becb..b663b03fcc89dbb0e6ae1ac66fa7ce938cb720a7 100644 |
| --- a/runtime/vm/profiler.h |
| +++ b/runtime/vm/profiler.h |
| @@ -41,21 +41,11 @@ class Profiler : public AllStatic { |
| return sample_buffer_; |
| } |
| + |
|
siva
2014/02/12 00:58:52
We usually have only one blank line before 'privat
|
| private: |
| static bool initialized_; |
| static Monitor* monitor_; |
| - static intptr_t ProcessSamples(Isolate* isolate, |
| - ProfilerCodeRegionTable* code_region_table, |
| - SampleBuffer* sample_buffer); |
| - |
| - static intptr_t ProcessSample(Isolate* isolate, |
| - ProfilerCodeRegionTable* code_region_table, |
| - Sample* sample); |
| - |
| - static void RecordTickInterruptCallback(const InterruptedThreadState& state, |
| - void* data); |
| - |
| static void RecordSampleInterruptCallback(const InterruptedThreadState& state, |
| void* data); |
| @@ -126,6 +116,33 @@ class Sample { |
| }; |
| +class SampleVisitor { |
| + public: |
| + explicit SampleVisitor(Isolate* isolate); |
| + virtual ~SampleVisitor() {} |
| + |
| + virtual void VisitSample(Sample* sample) = 0; |
| + |
| + intptr_t visited() const { |
| + return visited_; |
| + } |
| + |
| + void IncrementVisited() { |
| + visited_++; |
| + } |
| + |
| + Isolate* isolate() const { |
| + return isolate_; |
| + } |
| + |
| + private: |
| + Isolate* isolate_; |
| + intptr_t visited_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(SampleVisitor); |
| +}; |
| + |
| + |
| // Ring buffer of samples. |
| class SampleBuffer { |
| public: |
| @@ -139,6 +156,8 @@ class SampleBuffer { |
| void CopySample(intptr_t i, Sample* sample) const; |
| Sample* At(intptr_t idx) const; |
| + void VisitSamples(SampleVisitor* visitor); |
| + |
| private: |
| Sample* samples_; |
| intptr_t capacity_; |
| @@ -148,35 +167,6 @@ class SampleBuffer { |
| }; |
| -class ProfilerSampleStackWalker : public ValueObject { |
| - public: |
| - ProfilerSampleStackWalker(Sample* sample, |
| - uintptr_t stack_lower, |
| - uintptr_t stack_upper, |
| - uintptr_t pc, |
| - uintptr_t fp, |
| - uintptr_t sp); |
| - |
| - int walk(); |
| - |
| - private: |
| - uword* CallerPC(uword* fp); |
| - uword* CallerFP(uword* fp); |
| - |
| - bool ValidInstructionPointer(uword* pc); |
| - |
| - bool ValidFramePointer(uword* fp); |
| - |
| - Sample* sample_; |
| - const uintptr_t stack_lower_; |
| - const uintptr_t stack_upper_; |
| - const uintptr_t original_pc_; |
| - const uintptr_t original_fp_; |
| - const uintptr_t original_sp_; |
| - uintptr_t lower_bound_; |
| -}; |
| - |
| - |
| } // namespace dart |
| #endif // VM_PROFILER_H_ |