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 } | |
107 | 105 |
108 // StackSamplingProfiler::CallStackProfile ------------------------------------ | 106 // StackSamplingProfiler::CallStackProfile ------------------------------------ |
109 | 107 |
110 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} | 108 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} |
111 | 109 |
112 StackSamplingProfiler::CallStackProfile::CallStackProfile( | 110 StackSamplingProfiler::CallStackProfile::CallStackProfile( |
113 const CallStackProfile& other) = default; | 111 const CallStackProfile& other) = default; |
114 | 112 |
115 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} | 113 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} |
116 | 114 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 sampling_thread_.reset(); | 268 sampling_thread_.reset(); |
271 } | 269 } |
272 | 270 |
273 void StackSamplingProfiler::Stop() { | 271 void StackSamplingProfiler::Stop() { |
274 if (sampling_thread_) | 272 if (sampling_thread_) |
275 sampling_thread_->Stop(); | 273 sampling_thread_->Stop(); |
276 } | 274 } |
277 | 275 |
278 // StackSamplingProfiler::Frame global functions ------------------------------ | 276 // StackSamplingProfiler::Frame global functions ------------------------------ |
279 | 277 |
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 | |
286 bool operator==(const StackSamplingProfiler::Frame &a, | 278 bool operator==(const StackSamplingProfiler::Frame &a, |
287 const StackSamplingProfiler::Frame &b) { | 279 const StackSamplingProfiler::Frame &b) { |
288 return a.instruction_pointer == b.instruction_pointer && | 280 return a.instruction_pointer == b.instruction_pointer && |
289 a.module_index == b.module_index; | 281 a.module_index == b.module_index; |
290 } | 282 } |
291 | 283 |
292 bool operator<(const StackSamplingProfiler::Frame &a, | 284 bool operator<(const StackSamplingProfiler::Frame &a, |
293 const StackSamplingProfiler::Frame &b) { | 285 const StackSamplingProfiler::Frame &b) { |
294 return (a.module_index < b.module_index) || | 286 return (a.module_index < b.module_index) || |
295 (a.module_index == b.module_index && | 287 (a.module_index == b.module_index && |
296 a.instruction_pointer < b.instruction_pointer); | 288 a.instruction_pointer < b.instruction_pointer); |
297 } | 289 } |
298 | 290 |
299 } // namespace base | 291 } // namespace base |
OLD | NEW |