OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 6 #define BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/profiler/stack_sampling_profiler.h" |
| 10 #include "base/threading/platform_thread.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 // NativeStackSampler is an implementation detail of StackSamplingProfiler. It |
| 15 // abstracts the native implementation required to record a stack sample for a |
| 16 // given thread. |
| 17 class NativeStackSampler { |
| 18 public: |
| 19 virtual ~NativeStackSampler(); |
| 20 |
| 21 // Creates a stack sampler that records samples for |thread_handle|. Returns |
| 22 // null if this platform does not support stack sampling. |
| 23 static scoped_ptr<NativeStackSampler> Create(PlatformThreadId thread_id); |
| 24 |
| 25 // The following functions are all called on the SamplingThread (not the |
| 26 // thread being sampled). |
| 27 |
| 28 // Notifies the sampler that we're starting to record a new profile. Modules |
| 29 // shared across samples in the profile should be recorded in |modules|. |
| 30 virtual void ProfileRecordingStarting( |
| 31 std::vector<StackSamplingProfiler::Module>* modules) = 0; |
| 32 |
| 33 // Records a stack sample to |sample|. |
| 34 virtual void RecordStackSample(StackSamplingProfiler::Sample* sample) = 0; |
| 35 |
| 36 // Notifies the sampler that we've stopped recording the current |
| 37 // profile. |
| 38 virtual void ProfileRecordingStopped() = 0; |
| 39 |
| 40 protected: |
| 41 NativeStackSampler(); |
| 42 |
| 43 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(NativeStackSampler); |
| 45 }; |
| 46 |
| 47 } // namespace base |
| 48 |
| 49 #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 50 |
OLD | NEW |