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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 BASE_EXPORT Module { | 54 struct BASE_EXPORT Module { |
55 Module(); | 55 Module(); |
| 56 Module(const void* base_address, const std::string& id, |
| 57 const FilePath& filename); |
56 ~Module(); | 58 ~Module(); |
57 | 59 |
58 // Points to the base address of the module. | 60 // Points to the base address of the module. |
59 const void* base_address; | 61 const void* base_address; |
60 // An opaque binary string that uniquely identifies a particular program | 62 // An opaque binary string that uniquely identifies a particular program |
61 // version with high probability. This is parsed from headers of the loaded | 63 // version with high probability. This is parsed from headers of the loaded |
62 // module. | 64 // module. |
63 // For binaries generated by GNU tools: | 65 // For binaries generated by GNU tools: |
64 // Contents of the .note.gnu.build-id field. | 66 // Contents of the .note.gnu.build-id field. |
65 // On Windows: | 67 // On Windows: |
66 // GUID + AGE in the debug image headers of a module. | 68 // GUID + AGE in the debug image headers of a module. |
67 std::string id; | 69 std::string id; |
68 // The filename of the module. | 70 // The filename of the module. |
69 FilePath filename; | 71 FilePath filename; |
70 }; | 72 }; |
71 | 73 |
72 // Frame represents an individual sampled stack frame with module information. | 74 // Frame represents an individual sampled stack frame with module information. |
73 struct BASE_EXPORT Frame { | 75 struct BASE_EXPORT Frame { |
74 Frame(); | 76 Frame(); |
| 77 Frame(const void* instruction_pointer, int module_index); |
75 ~Frame(); | 78 ~Frame(); |
76 | 79 |
77 // The sampled instruction pointer within the function. | 80 // The sampled instruction pointer within the function. |
78 const void* instruction_pointer; | 81 const void* instruction_pointer; |
79 // Index of the module in the array of modules. We don't represent module | 82 // Index of the module in the array of modules. We don't represent module |
80 // state directly here to save space. | 83 // state directly here to save space. |
81 int module_index; | 84 int module_index; |
82 }; | 85 }; |
83 | 86 |
84 // Sample represents a set of stack frames. | 87 // Sample represents a set of stack frames. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Defined to allow equality check of Samples. | 200 // Defined to allow equality check of Samples. |
198 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, | 201 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, |
199 const StackSamplingProfiler::Frame& b); | 202 const StackSamplingProfiler::Frame& b); |
200 // Defined to allow ordering of Samples. | 203 // Defined to allow ordering of Samples. |
201 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, | 204 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, |
202 const StackSamplingProfiler::Frame& b); | 205 const StackSamplingProfiler::Frame& b); |
203 | 206 |
204 } // namespace base | 207 } // namespace base |
205 | 208 |
206 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ | 209 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ |
OLD | NEW |