Skip to content
  • bcwhite's avatar
    Support parallel captures from the StackSamplingProfiler. · 69e96449
    bcwhite authored
    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}
    69e96449