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

Unified Diff: content/browser/tracing/background_tracing_manager_impl.cc

Issue 2034553002: Set up background memory light tracing field trials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@set_whitelist
Patch Set: Remove navigation_tracing change and add base_export. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tracing/background_tracing_manager_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/background_tracing_manager_impl.cc
diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc
index d7d45ecfecf428c7c54f927866b38979aaa66e09..610b01881c2570af6b78c2ead730d16f4c2d7571 100644
--- a/content/browser/tracing/background_tracing_manager_impl.cc
+++ b/content/browser/tracing/background_tracing_manager_impl.cc
@@ -46,6 +46,15 @@ void RecordBackgroundTracingMetric(BackgroundTracingMetrics metric) {
NUMBER_OF_BACKGROUND_TRACING_METRICS);
}
+// Tracing enabled callback for BENCHMARK_MEMORY_LIGHT category preset.
+// TODO(ssid): Remove this when background tracing supports trace config strings
+// and memory-infra supports peak detection crbug.com/609935.
+void BenchmarkMemoryLight_TracingEnabledCallback() {
+ base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump(
+ base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
+ base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND);
+}
+
} // namespace
BackgroundTracingManagerImpl::TracingTimer::TracingTimer(
@@ -210,9 +219,8 @@ void BackgroundTracingManagerImpl::StartTracingIfConfigNeedsIt() {
return;
if (config_->tracing_mode() == BackgroundTracingConfigImpl::PREEMPTIVE) {
- StartTracing(
- GetCategoryFilterStringForCategoryPreset(config_->category_preset()),
- base::trace_event::RECORD_CONTINUOUSLY);
+ StartTracing(config_->category_preset(),
+ base::trace_event::RECORD_CONTINUOUSLY);
}
// There is nothing to do in case of reactive tracing.
}
@@ -313,8 +321,7 @@ void BackgroundTracingManagerImpl::OnRuleTriggered(
if (!is_tracing_) {
// It was not already tracing, start a new trace.
- StartTracing(GetCategoryFilterStringForCategoryPreset(
- triggered_rule->category_preset()),
+ StartTracing(triggered_rule->category_preset(),
base::trace_event::RECORD_UNTIL_FULL);
} else {
// Reactive configs that trigger again while tracing should just
@@ -388,14 +395,28 @@ void BackgroundTracingManagerImpl::FireTimerForTesting() {
}
void BackgroundTracingManagerImpl::StartTracing(
- std::string category_filter_str,
+ BackgroundTracingConfigImpl::CategoryPreset preset,
base::trace_event::TraceRecordMode record_mode) {
- base::trace_event::TraceConfig trace_config(category_filter_str, record_mode);
+ base::trace_event::TraceConfig trace_config(
+ GetCategoryFilterStringForCategoryPreset(preset), record_mode);
if (requires_anonymized_data_)
trace_config.EnableArgumentFilter();
+ base::Closure tracing_enabled_callback;
+ if (!tracing_enabled_callback_for_testing_.is_null()) {
+ tracing_enabled_callback = tracing_enabled_callback_for_testing_;
+ } else if (preset == BackgroundTracingConfigImpl::CategoryPreset::
+ BENCHMARK_MEMORY_LIGHT) {
+ // On memory light mode, the periodic memory dumps are disabled and a single
+ // memory dump is requested after tracing is enabled in all the processes.
+ trace_config.ResetMemoryDumpConfig(
+ base::trace_event::TraceConfig::MemoryDumpConfig());
+ tracing_enabled_callback =
+ base::Bind(&BenchmarkMemoryLight_TracingEnabledCallback);
+ }
+
is_tracing_ = TracingController::GetInstance()->StartTracing(
- trace_config, tracing_enabled_callback_for_testing_);
+ trace_config, tracing_enabled_callback);
RecordBackgroundTracingMetric(RECORDING_ENABLED);
}
@@ -519,6 +540,7 @@ BackgroundTracingManagerImpl::GetCategoryFilterStringForCategoryPreset(
case BackgroundTracingConfigImpl::CategoryPreset::BENCHMARK_BLINK_GC:
return "blink_gc,disabled-by-default-blink_gc";
case BackgroundTracingConfigImpl::CategoryPreset::BENCHMARK_MEMORY_HEAVY:
+ case BackgroundTracingConfigImpl::CategoryPreset::BENCHMARK_MEMORY_LIGHT:
return "-*,disabled-by-default-memory-infra";
case BackgroundTracingConfigImpl::CategoryPreset::
BENCHMARK_EXECUTION_METRIC:
« no previous file with comments | « content/browser/tracing/background_tracing_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698