OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ | 5 #ifndef BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ |
6 #define BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ | 6 #define BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // When all profiles are complete or the profiler is stopped, if the custom | 44 // When all profiles are complete or the profiler is stopped, if the custom |
45 // completed callback was set it will be called from the profiler thread with | 45 // completed callback was set it will be called from the profiler thread with |
46 // the completed profiles. If no callback was set, the profiles are stored | 46 // the completed profiles. If no callback was set, the profiles are stored |
47 // internally and retrieved for UMA through | 47 // internally and retrieved for UMA through |
48 // GetPendingProfiles(). GetPendingProfiles() should never be called by other | 48 // GetPendingProfiles(). GetPendingProfiles() should never be called by other |
49 // code; to retrieve profiles for in-process processing, set a completed | 49 // code; to retrieve profiles for in-process processing, set a completed |
50 // callback. | 50 // callback. |
51 class BASE_EXPORT StackSamplingProfiler { | 51 class BASE_EXPORT StackSamplingProfiler { |
52 public: | 52 public: |
53 // Module represents the module (DLL or exe) corresponding to a stack frame. | 53 // Module represents the module (DLL or exe) corresponding to a stack frame. |
54 struct Module { | 54 struct BASE_EXPORT Module { |
55 Module(); | 55 Module(); |
56 ~Module(); | 56 ~Module(); |
57 | 57 |
58 // Points to the base address of the module. | 58 // Points to the base address of the module. |
59 const void* base_address; | 59 const void* base_address; |
60 // An opaque binary string that uniquely identifies a particular program | 60 // An opaque binary string that uniquely identifies a particular program |
61 // version with high probability. This is parsed from headers of the loaded | 61 // version with high probability. This is parsed from headers of the loaded |
62 // module. | 62 // module. |
63 // For binaries generated by GNU tools: | 63 // For binaries generated by GNU tools: |
64 // Contents of the .note.gnu.build-id field. | 64 // Contents of the .note.gnu.build-id field. |
65 // On Windows: | 65 // On Windows: |
66 // GUID + AGE in the debug image headers of a module. | 66 // GUID + AGE in the debug image headers of a module. |
67 std::string id; | 67 std::string id; |
68 // The filename of the module. | 68 // The filename of the module. |
69 FilePath filename; | 69 FilePath filename; |
70 }; | 70 }; |
71 | 71 |
72 // Frame represents an individual sampled stack frame with module information. | 72 // Frame represents an individual sampled stack frame with module information. |
73 struct Frame { | 73 struct BASE_EXPORT Frame { |
74 Frame(); | 74 Frame(); |
75 ~Frame(); | 75 ~Frame(); |
76 | 76 |
77 // The sampled instruction pointer within the function. | 77 // The sampled instruction pointer within the function. |
78 const void* instruction_pointer; | 78 const void* instruction_pointer; |
79 // Index of the module in the array of modules. We don't represent module | 79 // Index of the module in the array of modules. We don't represent module |
80 // state directly here to save space. | 80 // state directly here to save space. |
81 int module_index; | 81 int module_index; |
82 }; | 82 }; |
83 | 83 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Defined to allow equality check of Samples. | 197 // Defined to allow equality check of Samples. |
198 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, | 198 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, |
199 const StackSamplingProfiler::Frame& b); | 199 const StackSamplingProfiler::Frame& b); |
200 // Defined to allow ordering of Samples. | 200 // Defined to allow ordering of Samples. |
201 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, | 201 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, |
202 const StackSamplingProfiler::Frame& b); | 202 const StackSamplingProfiler::Frame& b); |
203 | 203 |
204 } // namespace base | 204 } // namespace base |
205 | 205 |
206 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ | 206 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ |
OLD | NEW |