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

Unified Diff: base/trace_event/trace_options.h

Issue 1154133003: [Startup Tracing] Separate TraceOptions and CategoryFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gn build support Created 5 years, 7 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/trace_event/trace_event_unittest.cc ('k') | base/trace_event/trace_options.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_options.h
diff --git a/base/trace_event/trace_options.h b/base/trace_event/trace_options.h
new file mode 100644
index 0000000000000000000000000000000000000000..d09af676b65dba3d30dbd8482316070b553b60e2
--- /dev/null
+++ b/base/trace_event/trace_options.h
@@ -0,0 +1,79 @@
+// Copyright (c) 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_TRACE_EVENT_TRACE_OPTIONS_H_
+#define BASE_TRACE_EVENT_TRACE_OPTIONS_H_
+
+#include <string>
+
+#include "base/base_export.h"
+
+namespace base {
+namespace trace_event {
+
+// Options determines how the trace buffer stores data.
+enum TraceRecordMode {
+ // Record until the trace buffer is full.
+ RECORD_UNTIL_FULL,
+
+ // Record until the user ends the trace. The trace buffer is a fixed size
+ // and we use it as a ring buffer during recording.
+ RECORD_CONTINUOUSLY,
+
+ // Echo to console. Events are discarded.
+ ECHO_TO_CONSOLE,
+
+ // Record until the trace buffer is full, but with a huge buffer size.
+ RECORD_AS_MUCH_AS_POSSIBLE
+};
+
+struct BASE_EXPORT TraceOptions {
+ TraceOptions()
+ : record_mode(RECORD_UNTIL_FULL),
+ enable_sampling(false),
+ enable_systrace(false),
+ enable_argument_filter(false) {}
+
+ explicit TraceOptions(TraceRecordMode record_mode)
+ : record_mode(record_mode),
+ enable_sampling(false),
+ enable_systrace(false),
+ enable_argument_filter(false) {}
+
+ // |options_string| is a comma-delimited list of trace options.
+ // Possible options are: "record-until-full", "record-continuously",
+ // "trace-to-console", "enable-sampling" and "enable-systrace".
+ // The first 3 options are trace recoding modes and hence
+ // mutually exclusive. If more than one trace recording modes appear in the
+ // options_string, the last one takes precedence. If none of the trace
+ // recording mode is specified, recording mode is RECORD_UNTIL_FULL.
+ //
+ // The trace option will first be reset to the default option
+ // (record_mode set to RECORD_UNTIL_FULL, enable_sampling and enable_systrace
+ // set to false) before options parsed from |options_string| are applied on
+ // it.
+ // If |options_string| is invalid, the final state of trace_options is
+ // undefined.
+ //
+ // Example: trace_options.SetFromString("record-until-full")
+ // Example: trace_options.SetFromString(
+ // "record-continuously, enable-sampling")
+ // Example: trace_options.SetFromString("record-until-full, trace-to-console")
+ // will set ECHO_TO_CONSOLE as the recording mode.
+ //
+ // Returns true on success.
+ bool SetFromString(const std::string& options_string);
+
+ std::string ToString() const;
+
+ TraceRecordMode record_mode;
+ bool enable_sampling;
+ bool enable_systrace;
+ bool enable_argument_filter;
+};
+
+} // namespace trace_event
+} // namespace base
+
+#endif // BASE_TRACE_EVENT_TRACE_OPTIONS_H_
« no previous file with comments | « base/trace_event/trace_event_unittest.cc ('k') | base/trace_event/trace_options.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698