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

Unified Diff: base/debug/trace_event_impl.h

Issue 23556003: Implement about:tracing UI for the sampling profiler (Chromium part) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.h
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index e1bf148581627d1be976015380ca16f3700c6be8..3668cfb2367e5e7b7b04a86d906e63e6ecf0fa02 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -155,6 +155,7 @@ class BASE_EXPORT TraceBuffer {
virtual size_t Size() const = 0;
virtual size_t Capacity() const = 0;
virtual const TraceEvent& GetEventAt(size_t index) const = 0;
+ virtual TraceBuffer* Clone() const = 0;
};
// TraceResultBuffer collects and converts trace fragments returned by TraceLog
@@ -318,10 +319,16 @@ class BASE_EXPORT TraceLog {
// on how to control what categories will be traced.
void SetEnabled(const CategoryFilter& category_filter, Options options);
- // Disable tracing for all categories.
+ // Disables tracing for all categories.
void SetDisabled();
bool IsEnabled() { return !!enable_count_; }
+ // Enables continuous sampling tracing.
+ void SetContinuousSamplingEnabled();
+
+ // Disables continuous sampling tracing.
+ void SetContinuousSamplingDisabled();
+
// The number of times we have begun recording traces. If tracing is off,
// returns -1. If tracing is on, then it returns the number of times we have
// recorded a trace. By watching for this number to increment, you can
@@ -384,6 +391,7 @@ class BASE_EXPORT TraceLog {
typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)>
OutputCallback;
void Flush(const OutputCallback& cb);
+ void FlushContinuousSamplingTracing(const OutputCallback& cb);
// Called by TRACE_EVENT* macros, don't call this directly.
// The name parameter is a category group for example:
@@ -442,6 +450,8 @@ class BASE_EXPORT TraceLog {
// Exposed for unittesting:
void InstallWaitableEventForSamplingTesting(WaitableEvent* waitable_event);
+ void InstallWaitableEventForContinuousSamplingTesting(
+ WaitableEvent* waitable_event);
// Allows deleting our singleton instance.
static void DeleteForTesting();
@@ -532,7 +542,7 @@ class BASE_EXPORT TraceLog {
TraceLog();
~TraceLog();
const unsigned char* GetCategoryGroupEnabledInternal(const char* name);
- void AddMetadataEvents();
+ void AddMetadataEvents(unsigned char flags);
#if defined(OS_ANDROID)
void SendToATrace(char phase,
@@ -555,9 +565,11 @@ class BASE_EXPORT TraceLog {
// This lock protects TraceLog member accesses from arbitrary threads.
Lock lock_;
int enable_count_;
+ int continuous_sampling_enable_count_;
int num_traces_recorded_;
NotificationCallback notification_callback_;
scoped_ptr<TraceBuffer> logged_events_;
+ scoped_ptr<TraceBuffer> continuous_sampling_logged_events_;
EventCallback event_callback_;
bool dispatching_to_observer_list_;
std::vector<EnabledStateObserver*> enabled_state_observer_list_;
@@ -588,6 +600,13 @@ class BASE_EXPORT TraceLog {
scoped_ptr<TraceSamplingThread> sampling_thread_;
PlatformThreadHandle sampling_thread_handle_;
+ // Continuous sampling thread handles.
+ // TODO(haraken): Merge this thread with the normal sampling thread.
+ // Currently we launch two sampling threads when we
+ // record normal tracing with enabling continuous sampling.
+ scoped_ptr<TraceSamplingThread> continuous_sampling_thread_;
+ PlatformThreadHandle continuous_sampling_thread_handle_;
+
CategoryFilter category_filter_;
DISALLOW_COPY_AND_ASSIGN(TraceLog);
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698