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 #include "base/profiler/stack_sampling_profiler.h" | 5 #include "base/profiler/stack_sampling_profiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 StackSamplingProfiler::Module::~Module() {} | 94 StackSamplingProfiler::Module::~Module() {} |
95 | 95 |
96 // StackSamplingProfiler::Frame ----------------------------------------------- | 96 // StackSamplingProfiler::Frame ----------------------------------------------- |
97 | 97 |
98 StackSamplingProfiler::Frame::Frame(uintptr_t instruction_pointer, | 98 StackSamplingProfiler::Frame::Frame(uintptr_t instruction_pointer, |
99 size_t module_index) | 99 size_t module_index) |
100 : instruction_pointer(instruction_pointer), module_index(module_index) {} | 100 : instruction_pointer(instruction_pointer), module_index(module_index) {} |
101 | 101 |
102 StackSamplingProfiler::Frame::~Frame() {} | 102 StackSamplingProfiler::Frame::~Frame() {} |
103 | 103 |
104 StackSamplingProfiler::Frame::Frame() {} | 104 StackSamplingProfiler::Frame::Frame() |
| 105 : instruction_pointer(0), module_index(kUnknownModuleIndex) { |
| 106 } |
105 | 107 |
106 // StackSamplingProfiler::CallStackProfile ------------------------------------ | 108 // StackSamplingProfiler::CallStackProfile ------------------------------------ |
107 | 109 |
108 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} | 110 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} |
109 | 111 |
110 StackSamplingProfiler::CallStackProfile::CallStackProfile( | 112 StackSamplingProfiler::CallStackProfile::CallStackProfile( |
111 const CallStackProfile& other) = default; | 113 const CallStackProfile& other) = default; |
112 | 114 |
113 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} | 115 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} |
114 | 116 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 sampling_thread_.reset(); | 270 sampling_thread_.reset(); |
269 } | 271 } |
270 | 272 |
271 void StackSamplingProfiler::Stop() { | 273 void StackSamplingProfiler::Stop() { |
272 if (sampling_thread_) | 274 if (sampling_thread_) |
273 sampling_thread_->Stop(); | 275 sampling_thread_->Stop(); |
274 } | 276 } |
275 | 277 |
276 // StackSamplingProfiler::Frame global functions ------------------------------ | 278 // StackSamplingProfiler::Frame global functions ------------------------------ |
277 | 279 |
| 280 bool operator==(const StackSamplingProfiler::Module& a, |
| 281 const StackSamplingProfiler::Module& b) { |
| 282 return a.base_address == b.base_address && a.id == b.id && |
| 283 a.filename == b.filename; |
| 284 } |
| 285 |
278 bool operator==(const StackSamplingProfiler::Frame &a, | 286 bool operator==(const StackSamplingProfiler::Frame &a, |
279 const StackSamplingProfiler::Frame &b) { | 287 const StackSamplingProfiler::Frame &b) { |
280 return a.instruction_pointer == b.instruction_pointer && | 288 return a.instruction_pointer == b.instruction_pointer && |
281 a.module_index == b.module_index; | 289 a.module_index == b.module_index; |
282 } | 290 } |
283 | 291 |
284 bool operator<(const StackSamplingProfiler::Frame &a, | 292 bool operator<(const StackSamplingProfiler::Frame &a, |
285 const StackSamplingProfiler::Frame &b) { | 293 const StackSamplingProfiler::Frame &b) { |
286 return (a.module_index < b.module_index) || | 294 return (a.module_index < b.module_index) || |
287 (a.module_index == b.module_index && | 295 (a.module_index == b.module_index && |
288 a.instruction_pointer < b.instruction_pointer); | 296 a.instruction_pointer < b.instruction_pointer); |
289 } | 297 } |
290 | 298 |
291 } // namespace base | 299 } // namespace base |
OLD | NEW |