| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   56 // The results of the profiling are passed to the completed callback and consist |   56 // The results of the profiling are passed to the completed callback and consist | 
|   57 // of a vector of CallStackProfiles. Each CallStackProfile corresponds to a |   57 // of a vector of CallStackProfiles. Each CallStackProfile corresponds to a | 
|   58 // burst as specified in SamplingParams and contains a set of Samples and |   58 // burst as specified in SamplingParams and contains a set of Samples and | 
|   59 // Modules. One Sample corresponds to a single recorded stack, and the Modules |   59 // Modules. One Sample corresponds to a single recorded stack, and the Modules | 
|   60 // record those modules associated with the recorded stack frames. |   60 // record those modules associated with the recorded stack frames. | 
|   61 class BASE_EXPORT StackSamplingProfiler { |   61 class BASE_EXPORT StackSamplingProfiler { | 
|   62  public: |   62  public: | 
|   63   // Module represents the module (DLL or exe) corresponding to a stack frame. |   63   // Module represents the module (DLL or exe) corresponding to a stack frame. | 
|   64   struct BASE_EXPORT Module { |   64   struct BASE_EXPORT Module { | 
|   65     Module(); |   65     Module(); | 
|   66     Module(const void* base_address, const std::string& id, |   66     Module(uintptr_t base_address, | 
 |   67            const std::string& id, | 
|   67            const FilePath& filename); |   68            const FilePath& filename); | 
|   68     ~Module(); |   69     ~Module(); | 
|   69  |   70  | 
|   70     // Points to the base address of the module. |   71     // Points to the base address of the module. | 
|   71     const void* base_address; |   72     uintptr_t base_address; | 
|   72  |   73  | 
|   73     // An opaque binary string that uniquely identifies a particular program |   74     // An opaque binary string that uniquely identifies a particular program | 
|   74     // 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 | 
|   75     // module. |   76     // module. | 
|   76     // For binaries generated by GNU tools: |   77     // For binaries generated by GNU tools: | 
|   77     //   Contents of the .note.gnu.build-id field. |   78     //   Contents of the .note.gnu.build-id field. | 
|   78     // On Windows: |   79     // On Windows: | 
|   79     //   GUID + AGE in the debug image headers of a module. |   80     //   GUID + AGE in the debug image headers of a module. | 
|   80     std::string id; |   81     std::string id; | 
|   81  |   82  | 
|   82     // The filename of the module. |   83     // The filename of the module. | 
|   83     FilePath filename; |   84     FilePath filename; | 
|   84   }; |   85   }; | 
|   85  |   86  | 
|   86   // Frame represents an individual sampled stack frame with module information. |   87   // Frame represents an individual sampled stack frame with module information. | 
|   87   struct BASE_EXPORT Frame { |   88   struct BASE_EXPORT Frame { | 
|   88     // Identifies an unknown module. |   89     // Identifies an unknown module. | 
|   89     static const size_t kUnknownModuleIndex = static_cast<size_t>(-1); |   90     static const size_t kUnknownModuleIndex = static_cast<size_t>(-1); | 
|   90  |   91  | 
|   91     Frame(const void* instruction_pointer, size_t module_index); |   92     Frame(uintptr_t instruction_pointer, size_t module_index); | 
|   92     ~Frame(); |   93     ~Frame(); | 
|   93  |   94  | 
 |   95     // Default constructor to satisfy IPC macros. Do not use explicitly. | 
 |   96     Frame(); | 
 |   97  | 
|   94     // The sampled instruction pointer within the function. |   98     // The sampled instruction pointer within the function. | 
|   95     const void* instruction_pointer; |   99     uintptr_t instruction_pointer; | 
|   96  |  100  | 
|   97     // Index of the module in CallStackProfile::modules. We don't represent |  101     // Index of the module in CallStackProfile::modules. We don't represent | 
|   98     // module state directly here to save space. |  102     // module state directly here to save space. | 
|   99     size_t module_index; |  103     size_t module_index; | 
|  100   }; |  104   }; | 
|  101  |  105  | 
|  102   // Sample represents a set of stack frames. |  106   // Sample represents a set of stack frames. | 
|  103   using Sample = std::vector<Frame>; |  107   using Sample = std::vector<Frame>; | 
|  104  |  108  | 
|  105   // CallStackProfile represents a set of samples. |  109   // CallStackProfile represents a set of samples. | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  233 // The metrics provider code wants to put Samples in a map and compare them, |  237 // The metrics provider code wants to put Samples in a map and compare them, | 
|  234 // which requires us to define a few operators. |  238 // which requires us to define a few operators. | 
|  235 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, |  239 BASE_EXPORT bool operator==(const StackSamplingProfiler::Frame& a, | 
|  236                             const StackSamplingProfiler::Frame& b); |  240                             const StackSamplingProfiler::Frame& b); | 
|  237 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, |  241 BASE_EXPORT bool operator<(const StackSamplingProfiler::Frame& a, | 
|  238                            const StackSamplingProfiler::Frame& b); |  242                            const StackSamplingProfiler::Frame& b); | 
|  239  |  243  | 
|  240 }  // namespace base |  244 }  // namespace base | 
|  241  |  245  | 
|  242 #endif  // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ |  246 #endif  // BASE_PROFILER_STACK_SAMPLING_PROFILER_H_ | 
| OLD | NEW |