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

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

Issue 2254743003: Introduce mojo interface for collecting StackSamplingProfiler data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: disable test for iOS Created 4 years, 4 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 | « base/profiler/stack_sampling_profiler.h ('k') | components/metrics/BUILD.gn » ('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 #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
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
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
OLDNEW
« no previous file with comments | « base/profiler/stack_sampling_profiler.h ('k') | components/metrics/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698