| OLD | NEW |
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const char kPeriodicIntervalLegacyParam[] = "periodic_interval_ms"; | 45 const char kPeriodicIntervalLegacyParam[] = "periodic_interval_ms"; |
| 46 const char kHeapProfilerOptions[] = "heap_profiler_options"; | 46 const char kHeapProfilerOptions[] = "heap_profiler_options"; |
| 47 const char kBreakdownThresholdBytes[] = "breakdown_threshold_bytes"; | 47 const char kBreakdownThresholdBytes[] = "breakdown_threshold_bytes"; |
| 48 | 48 |
| 49 // String parameters used to parse category event filters. | 49 // String parameters used to parse category event filters. |
| 50 const char kEventFiltersParam[] = "event_filters"; | 50 const char kEventFiltersParam[] = "event_filters"; |
| 51 const char kFilterPredicateParam[] = "filter_predicate"; | 51 const char kFilterPredicateParam[] = "filter_predicate"; |
| 52 const char kFilterArgsParam[] = "filter_args"; | 52 const char kFilterArgsParam[] = "filter_args"; |
| 53 | 53 |
| 54 // Default configuration of memory dumps. | 54 // Default configuration of memory dumps. |
| 55 const TraceConfig::MemoryDumpConfig::Trigger kDefaultHeavyMemoryDumpTrigger = { | 55 const TraceConfig::MemoryDumpConfig::Trigger kDefaultMemoryDumpTrigger = { |
| 56 2000, // min_time_between_dumps_ms | 56 5000, // min_time_between_dumps_ms |
| 57 MemoryDumpLevelOfDetail::DETAILED, MemoryDumpType::PERIODIC_INTERVAL}; | 57 MemoryDumpLevelOfDetail::DETAILED, MemoryDumpType::PERIODIC_INTERVAL}; |
| 58 const TraceConfig::MemoryDumpConfig::Trigger kDefaultLightMemoryDumpTrigger = { | |
| 59 250, // min_time_between_dumps_ms | |
| 60 MemoryDumpLevelOfDetail::LIGHT, MemoryDumpType::PERIODIC_INTERVAL}; | |
| 61 | 58 |
| 62 class ConvertableTraceConfigToTraceFormat | 59 class ConvertableTraceConfigToTraceFormat |
| 63 : public base::trace_event::ConvertableToTraceFormat { | 60 : public base::trace_event::ConvertableToTraceFormat { |
| 64 public: | 61 public: |
| 65 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config) | 62 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config) |
| 66 : trace_config_(trace_config) {} | 63 : trace_config_(trace_config) {} |
| 67 | 64 |
| 68 ~ConvertableTraceConfigToTraceFormat() override {} | 65 ~ConvertableTraceConfigToTraceFormat() override {} |
| 69 | 66 |
| 70 void AppendAsTraceFormat(std::string* out) const override { | 67 void AppendAsTraceFormat(std::string* out) const override { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 static_cast<size_t>(min_size_bytes); | 452 static_cast<size_t>(min_size_bytes); |
| 456 } else { | 453 } else { |
| 457 memory_dump_config_.heap_profiler_options.breakdown_threshold_bytes = | 454 memory_dump_config_.heap_profiler_options.breakdown_threshold_bytes = |
| 458 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes; | 455 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes; |
| 459 } | 456 } |
| 460 } | 457 } |
| 461 } | 458 } |
| 462 | 459 |
| 463 void TraceConfig::SetDefaultMemoryDumpConfig() { | 460 void TraceConfig::SetDefaultMemoryDumpConfig() { |
| 464 memory_dump_config_.Clear(); | 461 memory_dump_config_.Clear(); |
| 465 memory_dump_config_.triggers.push_back(kDefaultHeavyMemoryDumpTrigger); | 462 memory_dump_config_.triggers.push_back(kDefaultMemoryDumpTrigger); |
| 466 memory_dump_config_.triggers.push_back(kDefaultLightMemoryDumpTrigger); | |
| 467 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes(); | 463 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes(); |
| 468 } | 464 } |
| 469 | 465 |
| 470 void TraceConfig::SetEventFiltersFromConfigList( | 466 void TraceConfig::SetEventFiltersFromConfigList( |
| 471 const base::ListValue& category_event_filters) { | 467 const base::ListValue& category_event_filters) { |
| 472 event_filters_.clear(); | 468 event_filters_.clear(); |
| 473 | 469 |
| 474 for (size_t event_filter_index = 0; | 470 for (size_t event_filter_index = 0; |
| 475 event_filter_index < category_event_filters.GetSize(); | 471 event_filter_index < category_event_filters.GetSize(); |
| 476 ++event_filter_index) { | 472 ++event_filter_index) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 579 } |
| 584 if (enable_systrace_) | 580 if (enable_systrace_) |
| 585 ret = ret + "," + kEnableSystrace; | 581 ret = ret + "," + kEnableSystrace; |
| 586 if (enable_argument_filter_) | 582 if (enable_argument_filter_) |
| 587 ret = ret + "," + kEnableArgumentFilter; | 583 ret = ret + "," + kEnableArgumentFilter; |
| 588 return ret; | 584 return ret; |
| 589 } | 585 } |
| 590 | 586 |
| 591 } // namespace trace_event | 587 } // namespace trace_event |
| 592 } // namespace base | 588 } // namespace base |
| OLD | NEW |