diff options
Diffstat (limited to 'base/trace_event/trace_config.h')
-rw-r--r-- | base/trace_event/trace_config.h | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/base/trace_event/trace_config.h b/base/trace_event/trace_config.h index a9f8306562..c7d3f4b379 100644 --- a/base/trace_event/trace_config.h +++ b/base/trace_event/trace_config.h @@ -1,20 +1,25 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// 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_TRACE_EVENT_TRACE_CONFIG_H_ #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ +#include <stdint.h> + #include <string> #include <vector> #include "base/base_export.h" #include "base/gtest_prod_util.h" +#include "base/trace_event/memory_dump_request_args.h" #include "base/values.h" namespace base { namespace trace_event { +class ConvertableToTraceFormat; + // Options determines how the trace buffer stores data. enum TraceRecordMode { // Record until the trace buffer is full. @@ -35,6 +40,15 @@ class BASE_EXPORT TraceConfig { public: typedef std::vector<std::string> StringList; + // Specifies the memory dump config for tracing. Used only when + // "memory-infra" category is enabled. + struct MemoryDumpTriggerConfig { + uint32_t periodic_interval_ms; + MemoryDumpLevelOfDetail level_of_detail; + }; + + typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; + TraceConfig(); // Create TraceConfig object from category filter and trace options strings. @@ -99,10 +113,21 @@ class BASE_EXPORT TraceConfig { // "enable_argument_filter": true, // "included_categories": ["included", // "inc_pattern*", - // "disabled-by-default-category1"], + // "disabled-by-default-memory-infra"], // "excluded_categories": ["excluded", "exc_pattern*"], // "synthetic_delays": ["test.Delay1;16", "test.Delay2;32"] + // "memory_dump_config": { + // "triggers": [ + // { + // "mode": "detailed", + // "periodic_interval_ms": 2000 + // } + // ] + // } // } + // + // Note: memory_dump_config can be specified only if + // disabled-by-default-memory-infra category is enabled. explicit TraceConfig(const std::string& config_string); TraceConfig(const TraceConfig& tc); @@ -128,6 +153,9 @@ class BASE_EXPORT TraceConfig { // formatted. std::string ToString() const; + // Returns a scoped_refptr and wrap TraceConfig in ConvertableToTraceFormat + scoped_refptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; + // Write the string representation of the CategoryFilter part. std::string ToCategoryFilterString() const; @@ -140,6 +168,10 @@ class BASE_EXPORT TraceConfig { void Clear(); + const MemoryDumpConfig& memory_dump_config() const { + return memory_dump_config_; + } + private: FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, @@ -149,6 +181,9 @@ class BASE_EXPORT TraceConfig { FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, IsEmptyOrContainsLeadingOrTrailingWhitespace); + FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); + FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); + FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); // The default trace config, used when none is provided. // Allows all non-disabled-by-default categories through, except if they end @@ -169,6 +204,9 @@ class BASE_EXPORT TraceConfig { const char* param, const StringList& categories) const; + void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); + void SetDefaultMemoryDumpConfig(); + // Convert TraceConfig to the dict representation of the TraceConfig. void ToDict(base::DictionaryValue& dict) const; @@ -193,6 +231,8 @@ class BASE_EXPORT TraceConfig { bool enable_systrace_ : 1; bool enable_argument_filter_ : 1; + MemoryDumpConfig memory_dump_config_; + StringList included_categories_; StringList disabled_categories_; StringList excluded_categories_; |