| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} | 113 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} |
| 114 | 114 |
| 115 // StackSamplingProfiler::SamplingThread -------------------------------------- | 115 // StackSamplingProfiler::SamplingThread -------------------------------------- |
| 116 | 116 |
| 117 StackSamplingProfiler::SamplingThread::SamplingThread( | 117 StackSamplingProfiler::SamplingThread::SamplingThread( |
| 118 std::unique_ptr<NativeStackSampler> native_sampler, | 118 std::unique_ptr<NativeStackSampler> native_sampler, |
| 119 const SamplingParams& params, | 119 const SamplingParams& params, |
| 120 const CompletedCallback& completed_callback) | 120 const CompletedCallback& completed_callback) |
| 121 : native_sampler_(std::move(native_sampler)), | 121 : native_sampler_(std::move(native_sampler)), |
| 122 params_(params), | 122 params_(params), |
| 123 stop_event_(false, false), | 123 stop_event_(WaitableEvent::ResetPolicy::AUTOMATIC, |
| 124 WaitableEvent::InitialState::NOT_SIGNALED), |
| 124 completed_callback_(completed_callback) {} | 125 completed_callback_(completed_callback) {} |
| 125 | 126 |
| 126 StackSamplingProfiler::SamplingThread::~SamplingThread() {} | 127 StackSamplingProfiler::SamplingThread::~SamplingThread() {} |
| 127 | 128 |
| 128 void StackSamplingProfiler::SamplingThread::ThreadMain() { | 129 void StackSamplingProfiler::SamplingThread::ThreadMain() { |
| 129 PlatformThread::SetName("Chrome_SamplingProfilerThread"); | 130 PlatformThread::SetName("Chrome_SamplingProfilerThread"); |
| 130 | 131 |
| 131 // For now, just ignore any requests to profile while another profiler is | 132 // For now, just ignore any requests to profile while another profiler is |
| 132 // working. | 133 // working. |
| 133 if (!concurrent_profiling_lock.Get().Try()) | 134 if (!concurrent_profiling_lock.Get().Try()) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 282 } |
| 282 | 283 |
| 283 bool operator<(const StackSamplingProfiler::Frame &a, | 284 bool operator<(const StackSamplingProfiler::Frame &a, |
| 284 const StackSamplingProfiler::Frame &b) { | 285 const StackSamplingProfiler::Frame &b) { |
| 285 return (a.module_index < b.module_index) || | 286 return (a.module_index < b.module_index) || |
| 286 (a.module_index == b.module_index && | 287 (a.module_index == b.module_index && |
| 287 a.instruction_pointer < b.instruction_pointer); | 288 a.instruction_pointer < b.instruction_pointer); |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace base | 291 } // namespace base |
| OLD | NEW |