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

Side by Side Diff: base/trace_event/trace_config.h

Issue 1911643002: Add configurable limit to allocations in heap profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_
6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ 6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 typedef std::vector<std::string> StringList; 41 typedef std::vector<std::string> StringList;
42 42
43 // Specifies the memory dump config for tracing. Used only when 43 // Specifies the memory dump config for tracing. Used only when
44 // "memory-infra" category is enabled. 44 // "memory-infra" category is enabled.
45 struct MemoryDumpTriggerConfig { 45 struct MemoryDumpTriggerConfig {
46 uint32_t periodic_interval_ms; 46 uint32_t periodic_interval_ms;
47 MemoryDumpLevelOfDetail level_of_detail; 47 MemoryDumpLevelOfDetail level_of_detail;
48 }; 48 };
49 49
50 typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; 50 typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig;
Primiano Tucci (use gerrit) 2016/04/21 16:53:22 I think this is the culprit. Today typedef std::
51 51
52 TraceConfig(); 52 TraceConfig();
53 53
54 // Create TraceConfig object from category filter and trace options strings. 54 // Create TraceConfig object from category filter and trace options strings.
55 // 55 //
56 // |category_filter_string| is a comma-delimited list of category wildcards. 56 // |category_filter_string| is a comma-delimited list of category wildcards.
57 // A category can have an optional '-' prefix to make it an excluded category. 57 // A category can have an optional '-' prefix to make it an excluded category.
58 // All the same rules apply above, so for example, having both included and 58 // All the same rules apply above, so for example, having both included and
59 // excluded categories in the same list would not be supported. 59 // excluded categories in the same list would not be supported.
60 // 60 //
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 TraceConfig& operator=(const TraceConfig& rhs); 141 TraceConfig& operator=(const TraceConfig& rhs);
142 142
143 // Return a list of the synthetic delays specified in this category filter. 143 // Return a list of the synthetic delays specified in this category filter.
144 const StringList& GetSyntheticDelayValues() const; 144 const StringList& GetSyntheticDelayValues() const;
145 145
146 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } 146 TraceRecordMode GetTraceRecordMode() const { return record_mode_; }
147 bool IsSamplingEnabled() const { return enable_sampling_; } 147 bool IsSamplingEnabled() const { return enable_sampling_; }
148 bool IsSystraceEnabled() const { return enable_systrace_; } 148 bool IsSystraceEnabled() const { return enable_systrace_; }
149 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } 149 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; }
150 size_t GetMinAllocationSizeBytes() const {
Primiano Tucci (use gerrit) 2016/04/21 16:53:22 I think this should be just part of MemoryDumpConf
151 return min_allocation_size_bytes_;
152 }
150 153
151 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } 154 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; }
152 void EnableSampling() { enable_sampling_ = true; } 155 void EnableSampling() { enable_sampling_ = true; }
153 void EnableSystrace() { enable_systrace_ = true; } 156 void EnableSystrace() { enable_systrace_ = true; }
154 void EnableArgumentFilter() { enable_argument_filter_ = true; } 157 void EnableArgumentFilter() { enable_argument_filter_ = true; }
155 158
156 // Writes the string representation of the TraceConfig. The string is JSON 159 // Writes the string representation of the TraceConfig. The string is JSON
157 // formatted. 160 // formatted.
158 std::string ToString() const; 161 std::string ToString() const;
159 162
(...skipping 22 matching lines...) Expand all
182 TraceConfigFromInvalidLegacyStrings); 185 TraceConfigFromInvalidLegacyStrings);
183 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig); 186 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig);
184 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); 187 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString);
185 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); 188 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString);
186 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, 189 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
187 IsEmptyOrContainsLeadingOrTrailingWhitespace); 190 IsEmptyOrContainsLeadingOrTrailingWhitespace);
188 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); 191 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString);
189 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); 192 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig);
190 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); 193 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest);
191 194
195 // Default value for |min_allocation_size_bytes_|.
196 static const int kDefaultMinAllocationSizeBytes = 1024;
197
192 // The default trace config, used when none is provided. 198 // The default trace config, used when none is provided.
193 // Allows all non-disabled-by-default categories through, except if they end 199 // Allows all non-disabled-by-default categories through, except if they end
194 // in the suffix 'Debug' or 'Test'. 200 // in the suffix 'Debug' or 'Test'.
195 void InitializeDefault(); 201 void InitializeDefault();
196 202
197 // Initialize from a config dictionary. 203 // Initialize from a config dictionary.
198 void InitializeFromConfigDict(const DictionaryValue& dict); 204 void InitializeFromConfigDict(const DictionaryValue& dict);
199 205
200 // Initialize from a config string. 206 // Initialize from a config string.
201 void InitializeFromConfigString(const std::string& config_string); 207 void InitializeFromConfigString(const std::string& config_string);
(...skipping 30 matching lines...) Expand all
232 const std::string& str); 238 const std::string& str);
233 239
234 bool HasIncludedPatterns() const; 240 bool HasIncludedPatterns() const;
235 241
236 TraceRecordMode record_mode_; 242 TraceRecordMode record_mode_;
237 bool enable_sampling_ : 1; 243 bool enable_sampling_ : 1;
238 bool enable_systrace_ : 1; 244 bool enable_systrace_ : 1;
239 bool enable_argument_filter_ : 1; 245 bool enable_argument_filter_ : 1;
240 246
241 MemoryDumpConfig memory_dump_config_; 247 MemoryDumpConfig memory_dump_config_;
248 size_t min_allocation_size_bytes_;
242 249
243 StringList included_categories_; 250 StringList included_categories_;
244 StringList disabled_categories_; 251 StringList disabled_categories_;
245 StringList excluded_categories_; 252 StringList excluded_categories_;
246 StringList synthetic_delays_; 253 StringList synthetic_delays_;
247 }; 254 };
248 255
249 } // namespace trace_event 256 } // namespace trace_event
250 } // namespace base 257 } // namespace base
251 258
252 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ 259 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698