diff options
-rw-r--r-- | base/trace_event/trace_config.cc | 49 | ||||
-rw-r--r-- | base/trace_event/trace_config.h | 9 | ||||
-rw-r--r-- | base/trace_event/trace_config_unittest.cc | 64 | ||||
-rw-r--r-- | components/tracing/trace_config_file.cc | 5 | ||||
-rw-r--r-- | content/browser/devtools/protocol/tracing_handler.cc | 86 | ||||
-rw-r--r-- | content/browser/devtools/protocol/tracing_handler.h | 10 | ||||
-rw-r--r-- | content/browser/devtools/protocol/tracing_handler_unittest.cc | 73 | ||||
-rw-r--r-- | content/content_tests.gypi | 1 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp | 9 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h | 2 | ||||
-rw-r--r-- | third_party/WebKit/Source/devtools/protocol.json | 40 |
11 files changed, 310 insertions, 38 deletions
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc index d60c081..c2c7ad7 100644 --- a/base/trace_event/trace_config.cc +++ b/base/trace_event/trace_config.cc @@ -105,6 +105,10 @@ TraceConfig::TraceConfig(const std::string& category_filter_string, InitializeFromStrings(category_filter_string, trace_options_string); } +TraceConfig::TraceConfig(const DictionaryValue& config) { + InitializeFromConfigDict(config); +} + TraceConfig::TraceConfig(const std::string& config_string) { if (!config_string.empty()) InitializeFromConfigString(config_string); @@ -288,18 +292,10 @@ void TraceConfig::InitializeDefault() { excluded_categories_.push_back("*Test"); } -void TraceConfig::InitializeFromConfigString(const std::string& config_string) { - scoped_ptr<base::Value> value(base::JSONReader::Read(config_string)); - if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) { - InitializeDefault(); - return; - } - scoped_ptr<base::DictionaryValue> dict( - static_cast<base::DictionaryValue*>(value.release())); - +void TraceConfig::InitializeFromConfigDict(const DictionaryValue& dict) { record_mode_ = RECORD_UNTIL_FULL; std::string record_mode; - if (dict->GetString(kRecordModeParam, &record_mode)) { + if (dict.GetString(kRecordModeParam, &record_mode)) { if (record_mode == kRecordUntilFull) { record_mode_ = RECORD_UNTIL_FULL; } else if (record_mode == kRecordContinuously) { @@ -312,42 +308,57 @@ void TraceConfig::InitializeFromConfigString(const std::string& config_string) { } bool enable_sampling; - if (!dict->GetBoolean(kEnableSamplingParam, &enable_sampling)) + if (!dict.GetBoolean(kEnableSamplingParam, &enable_sampling)) enable_sampling_ = false; else enable_sampling_ = enable_sampling; bool enable_systrace; - if (!dict->GetBoolean(kEnableSystraceParam, &enable_systrace)) + if (!dict.GetBoolean(kEnableSystraceParam, &enable_systrace)) enable_systrace_ = false; else enable_systrace_ = enable_systrace; bool enable_argument_filter; - if (!dict->GetBoolean(kEnableArgumentFilterParam, &enable_argument_filter)) + if (!dict.GetBoolean(kEnableArgumentFilterParam, &enable_argument_filter)) enable_argument_filter_ = false; else enable_argument_filter_ = enable_argument_filter; - base::ListValue* category_list = nullptr; - if (dict->GetList(kIncludedCategoriesParam, &category_list)) + const base::ListValue* category_list = nullptr; + if (dict.GetList(kIncludedCategoriesParam, &category_list)) SetCategoriesFromIncludedList(*category_list); - if (dict->GetList(kExcludedCategoriesParam, &category_list)) + if (dict.GetList(kExcludedCategoriesParam, &category_list)) SetCategoriesFromExcludedList(*category_list); - if (dict->GetList(kSyntheticDelaysParam, &category_list)) + if (dict.GetList(kSyntheticDelaysParam, &category_list)) SetSyntheticDelaysFromList(*category_list); if (IsCategoryEnabled(MemoryDumpManager::kTraceCategory)) { // If dump triggers not set, the client is using the legacy with just // category enabled. So, use the default periodic dump config. - base::DictionaryValue* memory_dump_config = nullptr; - if (dict->GetDictionary(kMemoryDumpConfigParam, &memory_dump_config)) + const base::DictionaryValue* memory_dump_config = nullptr; + if (dict.GetDictionary(kMemoryDumpConfigParam, &memory_dump_config)) SetMemoryDumpConfig(*memory_dump_config); else SetDefaultMemoryDumpConfig(); } } +void TraceConfig::InitializeFromConfigString(const std::string& config_string) { + scoped_ptr<Value> value(JSONReader::Read(config_string)); + if (!value) + return InitializeDefault(); + + const DictionaryValue* dict = nullptr; + bool is_dict = value->GetAsDictionary(&dict); + + if (!is_dict) + return InitializeDefault(); + + DCHECK(dict); + InitializeFromConfigDict(*dict); +} + void TraceConfig::InitializeFromStrings( const std::string& category_filter_string, const std::string& trace_options_string) { diff --git a/base/trace_event/trace_config.h b/base/trace_event/trace_config.h index 81b7d51..75e001b 100644 --- a/base/trace_event/trace_config.h +++ b/base/trace_event/trace_config.h @@ -130,6 +130,10 @@ class BASE_EXPORT TraceConfig { // disabled-by-default-memory-infra category is enabled. explicit TraceConfig(const std::string& config_string); + // Functionally identical to the above, but takes a parsed dictionary as input + // instead of its JSON serialization. + explicit TraceConfig(const DictionaryValue& config); + TraceConfig(const TraceConfig& tc); ~TraceConfig(); @@ -190,7 +194,10 @@ class BASE_EXPORT TraceConfig { // in the suffix 'Debug' or 'Test'. void InitializeDefault(); - // Initialize from the config string + // Initialize from a config dictionary. + void InitializeFromConfigDict(const DictionaryValue& dict); + + // Initialize from a config string. void InitializeFromConfigString(const std::string& config_string); // Initialize from category filter and trace options strings diff --git a/base/trace_event/trace_config_unittest.cc b/base/trace_event/trace_config_unittest.cc index bd37880..1b49fdc 100644 --- a/base/trace_event/trace_config_unittest.cc +++ b/base/trace_event/trace_config_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> +#include "base/json/json_reader.h" #include "base/macros.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_config.h" @@ -23,6 +24,27 @@ const char kDefaultTraceConfigString[] = "\"excluded_categories\":[\"*Debug\",\"*Test\"]," "\"record_mode\":\"record-until-full\"" "}"; + +const char kCustomTraceConfigString[] = + "{" + "\"enable_argument_filter\":true," + "\"enable_sampling\":true," + "\"enable_systrace\":true," + "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," + "\"included_categories\":[\"included\"," + "\"inc_pattern*\"," + "\"disabled-by-default-cc\"," + "\"disabled-by-default-memory-infra\"]," + "\"memory_dump_config\":{" + "\"triggers\":[" + "{\"mode\":\"light\",\"periodic_interval_ms\":50}," + "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" + "]" + "}," + "\"record_mode\":\"record-continuously\"," + "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" + "}"; + } // namespace TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) { @@ -259,6 +281,48 @@ TEST(TraceConfigTest, ConstructDefaultTraceConfig) { EXPECT_FALSE(tc.IsCategoryGroupEnabled("CategoryDebug,CategoryTest")); } +TEST(TraceConfigTest, TraceConfigFromDict) { + // Passing in empty dictionary will not result in default trace config. + DictionaryValue dict; + TraceConfig tc(dict); + EXPECT_STRNE(kDefaultTraceConfigString, tc.ToString().c_str()); + EXPECT_EQ(RECORD_UNTIL_FULL, tc.GetTraceRecordMode()); + EXPECT_FALSE(tc.IsSamplingEnabled()); + EXPECT_FALSE(tc.IsSystraceEnabled()); + EXPECT_FALSE(tc.IsArgumentFilterEnabled()); + EXPECT_STREQ("", tc.ToCategoryFilterString().c_str()); + + scoped_ptr<Value> default_value(JSONReader::Read(kDefaultTraceConfigString)); + DCHECK(default_value); + const DictionaryValue* default_dict = nullptr; + bool is_dict = default_value->GetAsDictionary(&default_dict); + DCHECK(is_dict); + TraceConfig default_tc(*default_dict); + EXPECT_STREQ(kDefaultTraceConfigString, default_tc.ToString().c_str()); + EXPECT_EQ(RECORD_UNTIL_FULL, default_tc.GetTraceRecordMode()); + EXPECT_FALSE(default_tc.IsSamplingEnabled()); + EXPECT_FALSE(default_tc.IsSystraceEnabled()); + EXPECT_FALSE(default_tc.IsArgumentFilterEnabled()); + EXPECT_STREQ("-*Debug,-*Test", default_tc.ToCategoryFilterString().c_str()); + + scoped_ptr<Value> custom_value(JSONReader::Read(kCustomTraceConfigString)); + DCHECK(custom_value); + const DictionaryValue* custom_dict = nullptr; + is_dict = custom_value->GetAsDictionary(&custom_dict); + DCHECK(is_dict); + TraceConfig custom_tc(*custom_dict); + EXPECT_STREQ(kCustomTraceConfigString, custom_tc.ToString().c_str()); + EXPECT_EQ(RECORD_CONTINUOUSLY, custom_tc.GetTraceRecordMode()); + EXPECT_TRUE(custom_tc.IsSamplingEnabled()); + EXPECT_TRUE(custom_tc.IsSystraceEnabled()); + EXPECT_TRUE(custom_tc.IsArgumentFilterEnabled()); + EXPECT_STREQ("included,inc_pattern*," + "disabled-by-default-cc,disabled-by-default-memory-infra," + "-excluded,-exc_pattern*," + "DELAY(test.Delay1;16),DELAY(test.Delay2;32)", + custom_tc.ToCategoryFilterString().c_str()); +} + TEST(TraceConfigTest, TraceConfigFromValidString) { // Using some non-empty config string. const char config_string[] = diff --git a/components/tracing/trace_config_file.cc b/components/tracing/trace_config_file.cc index 670bcc9..56e3ea5 100644 --- a/components/tracing/trace_config_file.cc +++ b/components/tracing/trace_config_file.cc @@ -11,7 +11,6 @@ #include "base/command_line.h" #include "base/files/file_util.h" #include "base/json/json_reader.h" -#include "base/json/json_writer.h" #include "base/logging.h" #include "base/memory/singleton.h" #include "base/values.h" @@ -108,9 +107,7 @@ bool TraceConfigFile::ParseTraceConfigFileContent(const std::string& content) { if (!dict->GetDictionary(kTraceConfigParam, &trace_config_dict)) return false; - std::string trace_config_str; - base::JSONWriter::Write(*trace_config_dict, &trace_config_str); - trace_config_ = base::trace_event::TraceConfig(trace_config_str); + trace_config_ = base::trace_event::TraceConfig(*trace_config_dict); if (!dict->GetInteger(kStartupDurationParam, &startup_duration_)) startup_duration_ = 0; diff --git a/content/browser/devtools/protocol/tracing_handler.cc b/content/browser/devtools/protocol/tracing_handler.cc index d856957..e7de4c7 100644 --- a/content/browser/devtools/protocol/tracing_handler.cc +++ b/content/browser/devtools/protocol/tracing_handler.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/format_macros.h" +#include "base/json/json_writer.h" #include "base/memory/ref_counted_memory.h" #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" @@ -30,6 +31,46 @@ namespace { const double kMinimumReportingInterval = 250.0; +const char kRecordModeParam[] = "record_mode"; + +// Convert from camel case to separator + lowercase. +std::string ConvertFromCamelCase(const std::string& in_str, char separator) { + std::string out_str; + out_str.reserve(in_str.size()); + for (const char& c : in_str) { + if (isupper(c)) { + out_str.push_back(separator); + out_str.push_back(tolower(c)); + } else { + out_str.push_back(c); + } + } + return out_str; +} + +scoped_ptr<base::Value> ConvertDictKeyStyle(const base::Value& value) { + const base::DictionaryValue* dict = nullptr; + if (value.GetAsDictionary(&dict)) { + scoped_ptr<base::DictionaryValue> out_dict(new base::DictionaryValue()); + for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); + it.Advance()) { + out_dict->Set(ConvertFromCamelCase(it.key(), '_'), + ConvertDictKeyStyle(it.value())); + } + return std::move(out_dict); + } + + const base::ListValue* list = nullptr; + if (value.GetAsList(&list)) { + scoped_ptr<base::ListValue> out_list(new base::ListValue()); + for (const auto& value : *list) + out_list->Append(ConvertDictKeyStyle(*value)); + return std::move(out_list); + } + + return value.CreateDeepCopy(); +} + class DevToolsTraceSinkProxy : public TracingController::TraceDataSink { public: explicit DevToolsTraceSinkProxy(base::WeakPtr<TracingHandler> handler) @@ -130,23 +171,37 @@ void TracingHandler::OnTraceToStreamComplete(const std::string& stream_handle) { TracingCompleteParams::Create()->set_stream(stream_handle)); } -Response TracingHandler::Start(DevToolsCommandId command_id, - const std::string* categories, - const std::string* options, - const double* buffer_usage_reporting_interval, - const std::string* transfer_mode) { +Response TracingHandler::Start( + DevToolsCommandId command_id, + const std::string* categories, + const std::string* options, + const double* buffer_usage_reporting_interval, + const std::string* transfer_mode, + const scoped_ptr<base::DictionaryValue>& config) { if (IsTracing()) return Response::InternalError("Tracing is already started"); + if (config && (categories || options)) { + return Response::InternalError( + "Either trace config (preferred), or categories+options should be " + "specified, but not both."); + } + did_initiate_recording_ = true; return_as_stream_ = transfer_mode && *transfer_mode == start::kTransferModeReturnAsStream; - base::trace_event::TraceConfig trace_config( - categories ? *categories : std::string(), - options ? *options : std::string()); if (buffer_usage_reporting_interval) SetupTimer(*buffer_usage_reporting_interval); + base::trace_event::TraceConfig trace_config; + if (config) { + trace_config = GetTraceConfigFromDevToolsConfig(*config); + } else if (categories || options) { + trace_config = base::trace_event::TraceConfig( + categories ? *categories : std::string(), + options ? *options : std::string()); + } + // If inspected target is a render process Tracing.start will be handled by // tracing agent in the renderer. TracingController::GetInstance()->StartTracing( @@ -281,6 +336,21 @@ bool TracingHandler::IsStartupTracingActive() { TracingController::GetInstance()->IsTracing(); } +// static +base::trace_event::TraceConfig TracingHandler::GetTraceConfigFromDevToolsConfig( + const base::DictionaryValue& devtools_config) { + scoped_ptr<base::Value> value = ConvertDictKeyStyle(devtools_config); + DCHECK(value && value->IsType(base::Value::TYPE_DICTIONARY)); + scoped_ptr<base::DictionaryValue> tracing_dict( + static_cast<base::DictionaryValue*>(value.release())); + + std::string mode; + if (tracing_dict->GetString(kRecordModeParam, &mode)) + tracing_dict->SetString(kRecordModeParam, ConvertFromCamelCase(mode, '-')); + + return base::trace_event::TraceConfig(*tracing_dict); +} + } // namespace tracing } // namespace devtools } // namespace content diff --git a/content/browser/devtools/protocol/tracing_handler.h b/content/browser/devtools/protocol/tracing_handler.h index 970710b..be3e6e4 100644 --- a/content/browser/devtools/protocol/tracing_handler.h +++ b/content/browser/devtools/protocol/tracing_handler.h @@ -11,10 +11,12 @@ #include <set> #include <string> +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/trace_event/trace_event.h" #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" +#include "content/common/content_export.h" #include "content/public/browser/tracing_controller.h" namespace base { @@ -51,7 +53,8 @@ class TracingHandler { const std::string* categories, const std::string* options, const double* buffer_usage_reporting_interval, - const std::string* transfer_mode); + const std::string* transfer_mode, + const scoped_ptr<base::DictionaryValue>& config); Response End(DevToolsCommandId command_id); Response GetCategories(DevToolsCommandId command); Response RequestMemoryDump(DevToolsCommandId command_id); @@ -73,6 +76,9 @@ class TracingHandler { const scoped_refptr<TracingController::TraceDataSink>& trace_data_sink); bool IsTracing() const; static bool IsStartupTracingActive(); + CONTENT_EXPORT static base::trace_event::TraceConfig + GetTraceConfigFromDevToolsConfig( + const base::DictionaryValue& devtools_config); scoped_ptr<base::Timer> buffer_usage_poll_timer_; Target target_; @@ -84,6 +90,8 @@ class TracingHandler { bool return_as_stream_; base::WeakPtrFactory<TracingHandler> weak_factory_; + FRIEND_TEST_ALL_PREFIXES(TracingHandlerTest, + GetTraceConfigFromDevToolsConfig); DISALLOW_COPY_AND_ASSIGN(TracingHandler); }; diff --git a/content/browser/devtools/protocol/tracing_handler_unittest.cc b/content/browser/devtools/protocol/tracing_handler_unittest.cc new file mode 100644 index 0000000..8182f45 --- /dev/null +++ b/content/browser/devtools/protocol/tracing_handler_unittest.cc @@ -0,0 +1,73 @@ +// Copyright 2016 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. + +#include "base/json/json_reader.h" +#include "base/trace_event/trace_config.h" +#include "base/values.h" +#include "content/browser/devtools/protocol/tracing_handler.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { +namespace devtools { +namespace tracing { + +namespace { + +const char kCustomTraceConfigString[] = + "{" + "\"enable_argument_filter\":true," + "\"enable_sampling\":true," + "\"enable_systrace\":true," + "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," + "\"included_categories\":[\"included\"," + "\"inc_pattern*\"," + "\"disabled-by-default-cc\"," + "\"disabled-by-default-memory-infra\"]," + "\"memory_dump_config\":{" + "\"triggers\":[" + "{\"mode\":\"light\",\"periodic_interval_ms\":50}," + "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" + "]" + "}," + "\"record_mode\":\"record-continuously\"," + "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" + "}"; + +const char kCustomTraceConfigStringDevToolsStyle[] = + "{" + "\"enableArgumentFilter\":true," + "\"enableSampling\":true," + "\"enableSystrace\":true," + "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," + "\"includedCategories\":[\"included\"," + "\"inc_pattern*\"," + "\"disabled-by-default-cc\"," + "\"disabled-by-default-memory-infra\"]," + "\"memoryDumpConfig\":{" + "\"triggers\":[" + "{\"mode\":\"light\",\"periodicIntervalMs\":50}," + "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" + "]" + "}," + "\"recordMode\":\"recordContinuously\"," + "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" + "}"; + +} + +TEST(TracingHandlerTest, GetTraceConfigFromDevToolsConfig) { + scoped_ptr<base::Value> value = base::JSONReader::Read( + kCustomTraceConfigStringDevToolsStyle); + scoped_ptr<base::DictionaryValue> devtools_style_dict( + static_cast<base::DictionaryValue*>(value.release())); + + base::trace_event::TraceConfig trace_config = + TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); + + EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); +} + +} // namespace tracing +} // namespace devtools +} // namespace content diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 517abca..0c7b82e 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -392,6 +392,7 @@ 'browser/device_sensors/sensor_manager_android_unittest.cc', 'browser/device_sensors/sensor_manager_chromeos_unittest.cc', 'browser/devtools/devtools_manager_unittest.cc', + 'browser/devtools/protocol/tracing_handler_unittest.cc', 'browser/devtools/shared_worker_devtools_manager_unittest.cc', 'browser/dom_storage/dom_storage_area_unittest.cc', 'browser/dom_storage/dom_storage_context_impl_unittest.cc', diff --git a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp index 14d9594..35f60e7 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp @@ -43,14 +43,21 @@ void InspectorTracingAgent::restore() { emitMetadataEvents(); } -void InspectorTracingAgent::start(ErrorString*, +void InspectorTracingAgent::start(ErrorString* errorString, const Maybe<String>& categories, const Maybe<String>& options, const Maybe<double>& bufferUsageReportingInterval, const Maybe<String>& transferMode, + const Maybe<protocol::Tracing::TraceConfig>& config, PassOwnPtr<StartCallback> callback) { ASSERT(sessionId().isEmpty()); + if (config.isJust()) { + *errorString = + "Using trace config on renderer targets is not supported yet."; + return; + } + m_state->setString(TracingAgentState::sessionId, IdentifiersFactory::createIdentifier()); m_client->enableTracing(categories.fromMaybe(String())); emitMetadataEvents(); diff --git a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h index e8dc541..3f647e3 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h +++ b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.h @@ -42,7 +42,7 @@ public: void disable(ErrorString*) override; // Protocol method implementations. - void start(ErrorString*, const Maybe<String>& categories, const Maybe<String>& options, const Maybe<double>& bufferUsageReportingInterval, const Maybe<String>& transferMode, PassOwnPtr<StartCallback>) override; + void start(ErrorString*, const Maybe<String>& categories, const Maybe<String>& options, const Maybe<double>& bufferUsageReportingInterval, const Maybe<String>& transferMode, const Maybe<protocol::Tracing::TraceConfig>&, PassOwnPtr<StartCallback>) override; void end(ErrorString*, PassOwnPtr<EndCallback>) override; // Methods for other agents to use. diff --git a/third_party/WebKit/Source/devtools/protocol.json b/third_party/WebKit/Source/devtools/protocol.json index d505f5b..5c5fb2b 100644 --- a/third_party/WebKit/Source/devtools/protocol.json +++ b/third_party/WebKit/Source/devtools/protocol.json @@ -4796,16 +4796,50 @@ }, { "domain": "Tracing", + "types": [ + { + "id": "MemoryDumpTrigger", + "type": "object", + "properties": [ + { "name": "mode", "type": "string", "enum": ["light", "detailed"], "description": "Level of detail of the triggered memory dumps." }, + { "name": "periodicIntervalMs", "type": "integer", "description": "Length of the periodic intervals between the triggered memory dumps." } + ], + "description": "Memory dump trigger configuration." + }, + { + "id": "MemoryDumpConfig", + "type": "object", + "properties": [ + { "name": "triggers", "type": "array", "items": { "$ref": "MemoryDumpTrigger" }, "optional": false, "description": "Memory dump trigger configuration." } + ], + "description": "Configuration for memory dump triggers. Used only when \"memory-infra\" category is enabled." + }, + { + "id": "TraceConfig", + "type": "object", + "properties": [ + { "name": "recordMode", "type": "string", "optional": true, "enum": ["recordUntilFull", "recordContinuously", "recordAsMuchAsPossible", "echoToConsole"], "description": "Controls how the trace buffer stores data." }, + { "name": "enableSampling", "type": "boolean", "optional": true, "description": "Turns on JavaScript stack sampling." }, + { "name": "enableSystrace", "type": "boolean", "optional": true, "description": "Turns on system tracing." }, + { "name": "enableArgumentFilter", "type": "boolean", "optional": true, "description": "Turns on argument filter." }, + { "name": "includedCategories", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Included category filters." }, + { "name": "excludedCategories", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Excluded category filters." }, + { "name": "syntheticDelays", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Configuration to synthesize the delays in tracing." }, + { "name": "memoryDumpConfig", "$ref": "MemoryDumpConfig", "optional": true, "description": "Configuration for memory dump triggers. Used only when \"memory-infra\" category is enabled." } + ] + } + ], "commands": [ { "name": "start", "async": true, "description": "Start trace events collection.", "parameters": [ - { "name": "categories", "type": "string", "optional": true, "description": "Category/tag filter" }, - { "name": "options", "type": "string", "optional": true, "description": "Tracing options" }, + { "name": "categories", "type": "string", "optional": true, "deprecated": true, "description": "Category/tag filter" }, + { "name": "options", "type": "string", "optional": true, "deprecated": true, "description": "Tracing options" }, { "name": "bufferUsageReportingInterval", "type": "number", "optional": true, "description": "If set, the agent will issue bufferUsage events at this interval, specified in milliseconds" }, - { "name": "transferMode", "type": "string", "enum": ["ReportEvents", "ReturnAsStream"], "optional": true, "description": "Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to <code>ReportEvents</code>)." } + { "name": "transferMode", "type": "string", "enum": ["ReportEvents", "ReturnAsStream"], "optional": true, "description": "Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to <code>ReportEvents</code>)." }, + { "name": "traceConfig", "$ref": "TraceConfig", "optional": true, "description": "" } ], "handlers": ["browser", "renderer"] }, |