The current StackSamplingProfiler supports only one at a time. Support parallel samples without creating multiple sampling threads.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/69e964496800e75cb0e3cdd974436659bd24e9cf commit 69e964496800e75cb0e3cdd974436659bd24e9cf Author: bcwhite <bcwhite@chromium.org> Date: Wed Apr 19 15:30:23 2017 Support parallel captures from the StackSamplingProfiler. Previously, only one sampling operation could be running and it was generally used to profile the startup of the browser. To make it more useful, it can now run against any thread and multiple profilers can execute in parallel. Sampling will continue until the desired number of samples has been collected, it is manually stopped, or the controlling object gets destructed. The SamplingThread is a singleton base::Thread that is self-managing. - It is started (via GetOrCreateTaskRunnerForAdd) on the calling thread when work arrives. - It stops (via ShutdownTask) on its own thread when it has been idle for 1 minute. - DetachFromSequence is called after both of these to allow for accessing the API from different threads. - thread_execution_state_lock_ is held when doing Thread API calls to ensure that access is sequenced. The sampled thread is expected to live at least as long as the thread controlling the sampling. BUG= 671716 Review-Url: https://codereview.chromium.org/2554123002 Cr-Commit-Position: refs/heads/master@{#465614} [modify] https://crrev.com/69e964496800e75cb0e3cdd974436659bd24e9cf/base/profiler/stack_sampling_profiler.cc [modify] https://crrev.com/69e964496800e75cb0e3cdd974436659bd24e9cf/base/profiler/stack_sampling_profiler.h [modify] https://crrev.com/69e964496800e75cb0e3cdd974436659bd24e9cf/base/profiler/stack_sampling_profiler_unittest.cc [modify] https://crrev.com/69e964496800e75cb0e3cdd974436659bd24e9cf/base/threading/thread_restrictions.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1a4d8f0a44795c09c519f9c96fec431793eb5837 commit 1a4d8f0a44795c09c519f9c96fec431793eb5837 Author: bcwhite <bcwhite@chromium.org> Date: Fri May 12 13:28:12 2017 Use a common buffer across all instances for stack-copy. BUG= 671716 Review-Url: https://codereview.chromium.org/2601633002 Cr-Commit-Position: refs/heads/master@{#471294} [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/native_stack_sampler.cc [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/native_stack_sampler.h [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/native_stack_sampler_mac.cc [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/native_stack_sampler_posix.cc [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/native_stack_sampler_win.cc [modify] https://crrev.com/1a4d8f0a44795c09c519f9c96fec431793eb5837/base/profiler/stack_sampling_profiler.cc
Comment 1 by bugdroid1@chromium.org
, Apr 19 2017