Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: base/profiler/stack_sampling_profiler.h

Issue 1319973011: Stack sampling profiler uses uintptr_t instead of void*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@UMA2_refactor
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/profiler/stack_sampling_profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // The results of the profiling are passed to the completed callback and consist 57 // The results of the profiling are passed to the completed callback and consist
58 // of a vector of CallStackProfiles. Each CallStackProfile corresponds to a 58 // of a vector of CallStackProfiles. Each CallStackProfile corresponds to a
59 // burst as specified in SamplingParams and contains a set of Samples and 59 // burst as specified in SamplingParams and contains a set of Samples and
60 // Modules. One Sample corresponds to a single recorded stack, and the Modules 60 // Modules. One Sample corresponds to a single recorded stack, and the Modules
61 // record those modules associated with the recorded stack frames. 61 // record those modules associated with the recorded stack frames.
62 class BASE_EXPORT StackSamplingProfiler { 62 class BASE_EXPORT StackSamplingProfiler {
63 public: 63 public:
64 // Module represents the module (DLL or exe) corresponding to a stack frame. 64 // Module represents the module (DLL or exe) corresponding to a stack frame.
65 struct BASE_EXPORT Module { 65 struct BASE_EXPORT Module {
66 Module(); 66 Module();
67 Module(const void* base_address, const std::string& id, 67 Module(const uintptr_t base_address, const std::string& id,
68 const FilePath& filename); 68 const FilePath& filename);
69 ~Module(); 69 ~Module();
70 70
71 // Points to the base address of the module. 71 // Points to the base address of the module.
72 const void* base_address; 72 uintptr_t base_address;
73 73
74 // An opaque binary string that uniquely identifies a particular program 74 // An opaque binary string that uniquely identifies a particular program
75 // version with high probability. This is parsed from headers of the loaded 75 // version with high probability. This is parsed from headers of the loaded
76 // module. 76 // module.
77 // For binaries generated by GNU tools: 77 // For binaries generated by GNU tools:
78 // Contents of the .note.gnu.build-id field. 78 // Contents of the .note.gnu.build-id field.
79 // On Windows: 79 // On Windows:
80 // GUID + AGE in the debug image headers of a module. 80 // GUID + AGE in the debug image headers of a module.
81 std::string id; 81 std::string id;
82 82
83 // The filename of the module. 83 // The filename of the module.
84 FilePath filename; 84 FilePath filename;
85 }; 85 };
86 86
87 // Frame represents an individual sampled stack frame with module information. 87 // Frame represents an individual sampled stack frame with module information.
88 struct BASE_EXPORT Frame { 88 struct BASE_EXPORT Frame {
89 // Identifies an unknown module. 89 // Identifies an unknown module.
90 static const size_t kUnknownModuleIndex = static_cast<size_t>(-1); 90 static const size_t kUnknownModuleIndex = static_cast<size_t>(-1);
91 91
92 Frame(const void* instruction_pointer, size_t module_index); 92 Frame(uintptr_t instruction_pointer, size_t module_index);
93 ~Frame(); 93 ~Frame();
94 94
95 // The sampled instruction pointer within the function. 95 // The sampled instruction pointer within the function.
96 const void* instruction_pointer; 96 uintptr_t instruction_pointer;
97 97
98 // Index of the module in CallStackProfile::modules. We don't represent 98 // Index of the module in CallStackProfile::modules. We don't represent
99 // module state directly here to save space. 99 // module state directly here to save space.
100 size_t module_index; 100 size_t module_index;
101 }; 101 };
102 102
103 // Sample represents a set of stack frames. 103 // Sample represents a set of stack frames.
104 using Sample = std::vector<Frame>; 104 using Sample = std::vector<Frame>;
105 105
106 // CallStackProfile represents a set of samples. 106 // CallStackProfile represents a set of samples.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // The metrics provider code wants to put Samples in a map and compare them, 233 // The metrics provider code wants to put Samples in a map and compare them,
234 // which requires us to define a few operators. 234 // which requires us to define a few operators.
235 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, 235 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a,
236 const StackSamplingProfiler::Frame& b); 236 const StackSamplingProfiler::Frame& b);
237 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, 237 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a,
238 const StackSamplingProfiler::Frame& b); 238 const StackSamplingProfiler::Frame& b);
239 239
240 } // namespace base 240 } // namespace base
241 241
242 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ 242 #endif // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | base/profiler/stack_sampling_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698