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

Unified Diff: base/profiler/stack_sampling_profiler.h

Issue 2554123002: Support parallel captures from the StackSamplingProfiler. (Closed)
Patch Set: switched to task-runner and address review comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/profiler/stack_sampling_profiler.cc » ('j') | base/profiler/stack_sampling_profiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/stack_sampling_profiler.h
diff --git a/base/profiler/stack_sampling_profiler.h b/base/profiler/stack_sampling_profiler.h
index 83e974767327b908dbfea7ec73bc893c00b99a36..638213c0599f3a36126af5eadde18c0397a451e6 100644
--- a/base/profiler/stack_sampling_profiler.h
+++ b/base/profiler/stack_sampling_profiler.h
@@ -233,44 +233,7 @@ class BASE_EXPORT StackSamplingProfiler {
private:
// SamplingThread is a separate thread used to suspend and sample stacks from
// the target thread.
- class SamplingThread : public PlatformThread::Delegate {
- public:
- // Samples stacks using |native_sampler|. When complete, invokes
- // |completed_callback| with the collected call stack profiles.
- // |completed_callback| must be callable on any thread.
- SamplingThread(std::unique_ptr<NativeStackSampler> native_sampler,
- const SamplingParams& params,
- const CompletedCallback& completed_callback);
- ~SamplingThread() override;
-
- // PlatformThread::Delegate:
- void ThreadMain() override;
-
- void Stop();
-
- private:
- // Collects |profile| from a single burst. If the profiler was stopped
- // during collection, sets |was_stopped| and provides the set of samples
- // collected up to that point.
- void CollectProfile(CallStackProfile* profile, TimeDelta* elapsed_time,
- bool* was_stopped);
-
- // Collects call stack profiles from all bursts, or until the sampling is
- // stopped. If stopped before complete, the last profile in
- // |call_stack_profiles| may contain a partial burst.
- void CollectProfiles(CallStackProfiles* profiles);
-
- std::unique_ptr<NativeStackSampler> native_sampler_;
- const SamplingParams params_;
-
- // If Stop() is called, it signals this event to force the sampling to
- // terminate before all the samples specified in |params_| are collected.
- WaitableEvent stop_event_;
-
- const CompletedCallback completed_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(SamplingThread);
- };
+ class SamplingThread;
// Adds annotations to a Sample.
static void RecordAnnotations(Sample* sample);
@@ -287,11 +250,11 @@ class BASE_EXPORT StackSamplingProfiler {
const SamplingParams params_;
- std::unique_ptr<SamplingThread> sampling_thread_;
- PlatformThreadHandle sampling_thread_handle_;
-
const CompletedCallback completed_callback_;
+ // An ID uniquely identifying this collection to the sampling thread.
+ int capture_id_ = -1;
+
// Stored until it can be passed to the NativeStackSampler created in Start().
NativeStackSamplerTestDelegate* const test_delegate_;
« no previous file with comments | « no previous file | base/profiler/stack_sampling_profiler.cc » ('j') | base/profiler/stack_sampling_profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698