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 | |
Peter Kasting
2015/03/31 01:51:25
You went back to using "SamplingThread" here inste
Mike Wittman
2015/03/31 19:29:41
Sorry, changed back to "thread used for sampling".
Peter Kasting
2015/04/01 06:16:40
Oh. You could say they're called by the SamplingT
Mike Wittman
2015/04/01 19:08:23
Done.
| |
26 // thread being sampled). | |
27 | |
28 // Notifies the sampler that we're starting to record a new profile. | |
Peter Kasting
2015/03/31 01:51:25
I wonder... should this API simply pass in a point
Mike Wittman
2015/03/31 19:29:41
I was on the fence about this when creating this i
| |
29 virtual void ProfileRecordingStarting( | |
30 StackSamplingProfiler::CallStackProfile* profile) = 0; | |
31 | |
32 // Records a stack sample. | |
Peter Kasting
2015/03/31 01:51:25
Nit: "... to |sample|."
Mike Wittman
2015/03/31 19:29:41
Done.
| |
33 virtual void RecordStackSample(StackSamplingProfiler::Sample* sample) = 0; | |
34 | |
35 // Notifies the sampler that we've stopped recording the current | |
36 // profile. | |
37 virtual void ProfileRecordingStopped() = 0; | |
38 | |
39 protected: | |
40 NativeStackSampler(); | |
41 | |
42 private: | |
43 DISALLOW_COPY_AND_ASSIGN(NativeStackSampler); | |
44 }; | |
45 | |
46 } // namespace base | |
47 | |
48 #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ | |
49 | |
OLD | NEW |