Chromium Code Reviews| 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 StackSamplingProfiler::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 // Notifies the sampler that we're starting to record a new profile. This | |
| 26 // function is called on the thread used for sampling. | |
|
Peter Kasting
2015/03/30 23:07:34
Nit: Perhaps put this above all these functions, t
Mike Wittman
2015/03/31 01:06:36
Done, although revised the proposed wording to be
| |
| 27 virtual void ProfileRecordingStarting(Profile* profile) = 0; | |
|
Peter Kasting
2015/03/30 23:07:34
Incidentally, I'm worried that the use of "Profile
Mike Wittman
2015/03/31 01:06:36
That's reasonable. I can change the name to CallSt
| |
| 28 | |
| 29 // Records a stack sample. This function is called on the thread used for | |
| 30 // sampling. | |
| 31 virtual void RecordStackSample(Sample* sample) = 0; | |
| 32 | |
| 33 // Notifies the sampler that we've stopped recording the current | |
| 34 // profile. This function is called on the thread used for sampling. | |
| 35 virtual void ProfileRecordingStopped() = 0; | |
| 36 | |
| 37 protected: | |
| 38 NativeStackSampler(); | |
| 39 | |
| 40 private: | |
| 41 DISALLOW_COPY_AND_ASSIGN(NativeStackSampler); | |
| 42 }; | |
| 43 | |
| 44 } // namespace base | |
| 45 | |
| 46 #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ | |
| 47 | |
| OLD | NEW |