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

Unified Diff: base/profiler/native_stack_sampler.h

Issue 1030923002: StackSamplingProfiler clean up (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: address comments Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/profiler/native_stack_sampler.h
diff --git a/base/profiler/native_stack_sampler.h b/base/profiler/native_stack_sampler.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb9ece8a9d1aa4be3306cac6464d86e7f2b857f5
--- /dev/null
+++ b/base/profiler/native_stack_sampler.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
+#define BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/profiler/stack_sampling_profiler.h"
+#include "base/threading/platform_thread.h"
+
+namespace base {
+
+// NativeStackSampler is an implementation detail of StackSamplingProfiler. It
+// abstracts the native implementation required to record a stack sample for a
+// given thread.
+class NativeStackSampler {
+ public:
+ virtual ~NativeStackSampler();
+
+ // Creates a stack sampler that records samples for |thread_handle|. Returns
+ // null if this platform does not support stack sampling.
+ static scoped_ptr<NativeStackSampler> Create(PlatformThreadId thread_id);
+
+ // The following functions are all called on the SamplingThread (not the
Peter Kasting 2015/03/31 01:51:25 You went back to using "SamplingThread" here inste
Mike Wittman 2015/03/31 19:29:41 Sorry, changed back to "thread used for sampling".
Peter Kasting 2015/04/01 06:16:40 Oh. You could say they're called by the SamplingT
Mike Wittman 2015/04/01 19:08:23 Done.
+ // thread being sampled).
+
+ // Notifies the sampler that we're starting to record a new profile.
Peter Kasting 2015/03/31 01:51:25 I wonder... should this API simply pass in a point
Mike Wittman 2015/03/31 19:29:41 I was on the fence about this when creating this i
+ virtual void ProfileRecordingStarting(
+ StackSamplingProfiler::CallStackProfile* profile) = 0;
+
+ // Records a stack sample.
Peter Kasting 2015/03/31 01:51:25 Nit: "... to |sample|."
Mike Wittman 2015/03/31 19:29:41 Done.
+ virtual void RecordStackSample(StackSamplingProfiler::Sample* sample) = 0;
+
+ // Notifies the sampler that we've stopped recording the current
+ // profile.
+ virtual void ProfileRecordingStopped() = 0;
+
+ protected:
+ NativeStackSampler();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NativeStackSampler);
+};
+
+} // namespace base
+
+#endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
+

Powered by Google App Engine
This is Rietveld 408576698