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