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

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

Issue 2259493003: [tracing] Add trace events filtering predicate for heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@heap_prof_filter
Patch Set: base_export and MakeUnique Created 4 years, 4 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/trace_config.h" 5 #include "base/trace_event/trace_config.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes; 622 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes;
623 } 623 }
624 } 624 }
625 } 625 }
626 626
627 void TraceConfig::SetDefaultMemoryDumpConfig() { 627 void TraceConfig::SetDefaultMemoryDumpConfig() {
628 memory_dump_config_.Clear(); 628 memory_dump_config_.Clear();
629 memory_dump_config_.triggers.push_back(kDefaultHeavyMemoryDumpTrigger); 629 memory_dump_config_.triggers.push_back(kDefaultHeavyMemoryDumpTrigger);
630 memory_dump_config_.triggers.push_back(kDefaultLightMemoryDumpTrigger); 630 memory_dump_config_.triggers.push_back(kDefaultLightMemoryDumpTrigger);
631 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes(); 631 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes();
632
633 if (AllocationContextTracker::capture_mode() ==
634 AllocationContextTracker::CaptureMode::PSEUDO_STACK) {
635 for (const auto& filter : event_filters_) {
636 if (filter.predicate_name() ==
637 TraceLog::TraceEventFilter::kHeapProfilerPredicate)
638 return;
639 }
640 // Adds a filter predicate to filter all categories for the heap profiler.
641 // Note that the heap profiler predicate does not filter any events.
Primiano Tucci (use gerrit) 2016/08/24 10:33:46 s/filter/filter-out/, so it's easier to understand
ssid 2016/08/24 18:01:25 Done.
642 EventFilterConfig heap_profiler_config(
643 TraceLog::TraceEventFilter::kHeapProfilerPredicate);
644 heap_profiler_config.AddIncludedCategory("*");
645 heap_profiler_config.AddIncludedCategory(MemoryDumpManager::kTraceCategory);
Primiano Tucci (use gerrit) 2016/08/24 10:33:46 do you really need to see the memory-infra events
ssid 2016/08/24 18:01:25 Actually this line is not required. But I added th
646 event_filters_.push_back(heap_profiler_config);
647 }
632 } 648 }
633 649
634 void TraceConfig::SetEventFilters( 650 void TraceConfig::SetEventFilters(
635 const base::ListValue& category_event_filters) { 651 const base::ListValue& category_event_filters) {
636 event_filters_.clear(); 652 event_filters_.clear();
637 653
638 for (size_t event_filter_index = 0; 654 for (size_t event_filter_index = 0;
639 event_filter_index < category_event_filters.GetSize(); 655 event_filter_index < category_event_filters.GetSize();
640 ++event_filter_index) { 656 ++event_filter_index) {
641 const base::DictionaryValue* event_filter = nullptr; 657 const base::DictionaryValue* event_filter = nullptr;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 StringPiece str) { 868 StringPiece str) {
853 return str.empty() || str.front() == ' ' || str.back() == ' '; 869 return str.empty() || str.front() == ' ' || str.back() == ' ';
854 } 870 }
855 871
856 bool TraceConfig::HasIncludedPatterns() const { 872 bool TraceConfig::HasIncludedPatterns() const {
857 return !included_categories_.empty(); 873 return !included_categories_.empty();
858 } 874 }
859 875
860 } // namespace trace_event 876 } // namespace trace_event
861 } // namespace base 877 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698