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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const char kTriggerTypeParam[] = "type"; | 44 const char kTriggerTypeParam[] = "type"; |
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. |
| 55 const TraceConfig::MemoryDumpConfig::Trigger kDefaultMemoryDumpTrigger = { |
| 56 5000, // min_time_between_dumps_ms |
| 57 MemoryDumpLevelOfDetail::DETAILED, MemoryDumpType::PERIODIC_INTERVAL}; |
| 58 |
54 class ConvertableTraceConfigToTraceFormat | 59 class ConvertableTraceConfigToTraceFormat |
55 : public base::trace_event::ConvertableToTraceFormat { | 60 : public base::trace_event::ConvertableToTraceFormat { |
56 public: | 61 public: |
57 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config) | 62 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config) |
58 : trace_config_(trace_config) {} | 63 : trace_config_(trace_config) {} |
59 | 64 |
60 ~ConvertableTraceConfigToTraceFormat() override {} | 65 ~ConvertableTraceConfigToTraceFormat() override {} |
61 | 66 |
62 void AppendAsTraceFormat(std::string* out) const override { | 67 void AppendAsTraceFormat(std::string* out) const override { |
63 out->append(trace_config_.ToString()); | 68 out->append(trace_config_.ToString()); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 static_cast<size_t>(min_size_bytes); | 452 static_cast<size_t>(min_size_bytes); |
448 } else { | 453 } else { |
449 memory_dump_config_.heap_profiler_options.breakdown_threshold_bytes = | 454 memory_dump_config_.heap_profiler_options.breakdown_threshold_bytes = |
450 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes; | 455 MemoryDumpConfig::HeapProfiler::kDefaultBreakdownThresholdBytes; |
451 } | 456 } |
452 } | 457 } |
453 } | 458 } |
454 | 459 |
455 void TraceConfig::SetDefaultMemoryDumpConfig() { | 460 void TraceConfig::SetDefaultMemoryDumpConfig() { |
456 memory_dump_config_.Clear(); | 461 memory_dump_config_.Clear(); |
| 462 memory_dump_config_.triggers.push_back(kDefaultMemoryDumpTrigger); |
457 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes(); | 463 memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes(); |
458 } | 464 } |
459 | 465 |
460 void TraceConfig::SetEventFiltersFromConfigList( | 466 void TraceConfig::SetEventFiltersFromConfigList( |
461 const base::ListValue& category_event_filters) { | 467 const base::ListValue& category_event_filters) { |
462 event_filters_.clear(); | 468 event_filters_.clear(); |
463 | 469 |
464 for (size_t event_filter_index = 0; | 470 for (size_t event_filter_index = 0; |
465 event_filter_index < category_event_filters.GetSize(); | 471 event_filter_index < category_event_filters.GetSize(); |
466 ++event_filter_index) { | 472 ++event_filter_index) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 } | 579 } |
574 if (enable_systrace_) | 580 if (enable_systrace_) |
575 ret = ret + "," + kEnableSystrace; | 581 ret = ret + "," + kEnableSystrace; |
576 if (enable_argument_filter_) | 582 if (enable_argument_filter_) |
577 ret = ret + "," + kEnableArgumentFilter; | 583 ret = ret + "," + kEnableArgumentFilter; |
578 return ret; | 584 return ret; |
579 } | 585 } |
580 | 586 |
581 } // namespace trace_event | 587 } // namespace trace_event |
582 } // namespace base | 588 } // namespace base |
OLD | NEW |