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

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 2739163004: [tracing] Use same code path for category filtering for recording and event filtering (Closed)
Patch Set: InitalizeWithString. Created 3 years, 9 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 #include "base/trace_event/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/allocator/features.h" 10 #include "base/allocator/features.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 #endif 233 #endif
234 234
235 TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory); 235 TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory);
236 236
237 // TODO(ssid): This should be done in EnableHeapProfiling so that we capture 237 // TODO(ssid): This should be done in EnableHeapProfiling so that we capture
238 // more allocations (crbug.com/625170). 238 // more allocations (crbug.com/625170).
239 if (AllocationContextTracker::capture_mode() == 239 if (AllocationContextTracker::capture_mode() ==
240 AllocationContextTracker::CaptureMode::PSEUDO_STACK && 240 AllocationContextTracker::CaptureMode::PSEUDO_STACK &&
241 !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) { 241 !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) {
242 // Create trace config with heap profiling filter. 242 // Create trace config with heap profiling filter.
243 std::string filter_string = "*";
244 const char* const kFilteredCategories[] = {
245 TRACE_DISABLED_BY_DEFAULT("net"), TRACE_DISABLED_BY_DEFAULT("cc"),
246 MemoryDumpManager::kTraceCategory};
247 for (const char* cat : kFilteredCategories)
248 filter_string = filter_string + "," + cat;
249 TraceConfigCategoryFilter category_filter;
250 category_filter.InitializeFromString(filter_string);
251
243 TraceConfig::EventFilterConfig heap_profiler_filter_config( 252 TraceConfig::EventFilterConfig heap_profiler_filter_config(
244 HeapProfilerEventFilter::kName); 253 HeapProfilerEventFilter::kName);
245 heap_profiler_filter_config.AddIncludedCategory("*"); 254 heap_profiler_filter_config.SetCategoryFilter(category_filter);
246 heap_profiler_filter_config.AddIncludedCategory( 255
247 MemoryDumpManager::kTraceCategory);
248 TraceConfig::EventFilters filters; 256 TraceConfig::EventFilters filters;
249 filters.push_back(heap_profiler_filter_config); 257 filters.push_back(heap_profiler_filter_config);
250 TraceConfig filtering_trace_config; 258 TraceConfig filtering_trace_config;
251 filtering_trace_config.SetEventFilters(filters); 259 filtering_trace_config.SetEventFilters(filters);
252 260
253 TraceLog::GetInstance()->SetEnabled(filtering_trace_config, 261 TraceLog::GetInstance()->SetEnabled(filtering_trace_config,
254 TraceLog::FILTERING_MODE); 262 TraceLog::FILTERING_MODE);
255 } 263 }
256 264
257 // If tracing was enabled before initializing MemoryDumpManager, we missed the 265 // If tracing was enabled before initializing MemoryDumpManager, we missed the
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (iter == process_dumps.end()) { 969 if (iter == process_dumps.end()) {
962 std::unique_ptr<ProcessMemoryDump> new_pmd( 970 std::unique_ptr<ProcessMemoryDump> new_pmd(
963 new ProcessMemoryDump(session_state, dump_args)); 971 new ProcessMemoryDump(session_state, dump_args));
964 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 972 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
965 } 973 }
966 return iter->second.get(); 974 return iter->second.get();
967 } 975 }
968 976
969 } // namespace trace_event 977 } // namespace trace_event
970 } // namespace base 978 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc ('k') | base/trace_event/trace_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698