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

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

Issue 2360143006: Stack sampling profiler: run the profiler in the GPU process on trunk builds (Closed)
Patch Set: address comments Created 4 years, 2 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 | « no previous file | chrome/browser/chrome_browser_main.h » ('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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/profiler/native_stack_sampler.h" 16 #include "base/profiler/native_stack_sampler.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/timer/elapsed_timer.h" 19 #include "base/timer/elapsed_timer.h"
20 20
21 namespace base { 21 namespace base {
22 22
23 namespace { 23 namespace {
24 24
25 // Used to ensure only one profiler is running at a time. 25 // Used to ensure only one profiler is running at a time.
26 LazyInstance<Lock> concurrent_profiling_lock = LAZY_INSTANCE_INITIALIZER; 26 LazyInstance<Lock>::Leaky concurrent_profiling_lock = LAZY_INSTANCE_INITIALIZER;
27 27
28 // AsyncRunner ---------------------------------------------------------------- 28 // AsyncRunner ----------------------------------------------------------------
29 29
30 // Helper class to allow a profiler to be run completely asynchronously from the 30 // Helper class to allow a profiler to be run completely asynchronously from the
31 // initiator, without being concerned with the profiler's lifetime. 31 // initiator, without being concerned with the profiler's lifetime.
32 class AsyncRunner { 32 class AsyncRunner {
33 public: 33 public:
34 // Sets up a profiler and arranges for it to be deleted on its completed 34 // Sets up a profiler and arranges for it to be deleted on its completed
35 // callback. 35 // callback.
36 static void Run(PlatformThreadId thread_id, 36 static void Run(PlatformThreadId thread_id,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 bool operator<(const StackSamplingProfiler::Frame &a, 292 bool operator<(const StackSamplingProfiler::Frame &a,
293 const StackSamplingProfiler::Frame &b) { 293 const StackSamplingProfiler::Frame &b) {
294 return (a.module_index < b.module_index) || 294 return (a.module_index < b.module_index) ||
295 (a.module_index == b.module_index && 295 (a.module_index == b.module_index &&
296 a.instruction_pointer < b.instruction_pointer); 296 a.instruction_pointer < b.instruction_pointer);
297 } 297 }
298 298
299 } // namespace base 299 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698