OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/browser/tracing/background_tracing_manager_impl.h" | 5 #include "content/browser/tracing/background_tracing_manager_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 SCENARIO_ACTION_FAILED_LOWRES_CLOCK = 9, | 40 SCENARIO_ACTION_FAILED_LOWRES_CLOCK = 9, |
41 NUMBER_OF_BACKGROUND_TRACING_METRICS, | 41 NUMBER_OF_BACKGROUND_TRACING_METRICS, |
42 }; | 42 }; |
43 | 43 |
44 void RecordBackgroundTracingMetric(BackgroundTracingMetrics metric) { | 44 void RecordBackgroundTracingMetric(BackgroundTracingMetrics metric) { |
45 UMA_HISTOGRAM_ENUMERATION("Tracing.Background.ScenarioState", metric, | 45 UMA_HISTOGRAM_ENUMERATION("Tracing.Background.ScenarioState", metric, |
46 NUMBER_OF_BACKGROUND_TRACING_METRICS); | 46 NUMBER_OF_BACKGROUND_TRACING_METRICS); |
47 } | 47 } |
48 | 48 |
49 // Tracing enabled callback for BENCHMARK_MEMORY_LIGHT category preset. | 49 // Tracing enabled callback for BENCHMARK_MEMORY_LIGHT category preset. |
50 // TODO(ssid): Remove this when background tracing supports trace config strings | |
51 // and memory-infra supports peak detection crbug.com/609935. | |
52 void BenchmarkMemoryLight_TracingEnabledCallback() { | 50 void BenchmarkMemoryLight_TracingEnabledCallback() { |
53 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( | 51 base::trace_event::MemoryDumpManager::GetInstance()->RequestGlobalDump( |
54 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, | 52 base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED, |
55 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND); | 53 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND); |
56 } | 54 } |
57 | 55 |
58 } // namespace | 56 } // namespace |
59 | 57 |
60 BackgroundTracingManagerImpl::TracingTimer::TracingTimer( | 58 BackgroundTracingManagerImpl::TracingTimer::TracingTimer( |
61 StartedFinalizingCallback callback) : callback_(callback) { | 59 StartedFinalizingCallback callback) : callback_(callback) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 if (requires_anonymized_data_) | 400 if (requires_anonymized_data_) |
403 trace_config.EnableArgumentFilter(); | 401 trace_config.EnableArgumentFilter(); |
404 | 402 |
405 base::Closure tracing_enabled_callback; | 403 base::Closure tracing_enabled_callback; |
406 if (!tracing_enabled_callback_for_testing_.is_null()) { | 404 if (!tracing_enabled_callback_for_testing_.is_null()) { |
407 tracing_enabled_callback = tracing_enabled_callback_for_testing_; | 405 tracing_enabled_callback = tracing_enabled_callback_for_testing_; |
408 } else if (preset == BackgroundTracingConfigImpl::CategoryPreset:: | 406 } else if (preset == BackgroundTracingConfigImpl::CategoryPreset:: |
409 BENCHMARK_MEMORY_LIGHT) { | 407 BENCHMARK_MEMORY_LIGHT) { |
410 // On memory light mode, the periodic memory dumps are disabled and a single | 408 // On memory light mode, the periodic memory dumps are disabled and a single |
411 // memory dump is requested after tracing is enabled in all the processes. | 409 // memory dump is requested after tracing is enabled in all the processes. |
410 // TODO(ssid): Remove this when background tracing supports trace config | |
411 // strings and memory-infra supports peak detection crbug.com/609935. | |
412 base::trace_event::TraceConfig::MemoryDumpConfig memory_config; | |
413 memory_config.allowed_dump_modes = | |
414 std::set<base::trace_event::MemoryDumpLevelOfDetail>( | |
415 {base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND}); | |
412 trace_config.ResetMemoryDumpConfig( | 416 trace_config.ResetMemoryDumpConfig( |
413 base::trace_event::TraceConfig::MemoryDumpConfig()); | 417 base::trace_event::TraceConfig::MemoryDumpConfig()); |
Primiano Tucci (use gerrit)
2016/06/09 18:46:39
ehm don't you have to pass memory_config here inst
ssid
2016/06/09 21:34:15
Done.
Yeah I think this should be fixed when we ca
| |
414 tracing_enabled_callback = | 418 tracing_enabled_callback = |
415 base::Bind(&BenchmarkMemoryLight_TracingEnabledCallback); | 419 base::Bind(&BenchmarkMemoryLight_TracingEnabledCallback); |
416 } | 420 } |
417 | 421 |
418 is_tracing_ = TracingController::GetInstance()->StartTracing( | 422 is_tracing_ = TracingController::GetInstance()->StartTracing( |
419 trace_config, tracing_enabled_callback); | 423 trace_config, tracing_enabled_callback); |
420 RecordBackgroundTracingMetric(RECORDING_ENABLED); | 424 RecordBackgroundTracingMetric(RECORDING_ENABLED); |
421 } | 425 } |
422 | 426 |
423 void BackgroundTracingManagerImpl::OnFinalizeStarted( | 427 void BackgroundTracingManagerImpl::OnFinalizeStarted( |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: | 552 case BackgroundTracingConfigImpl::CategoryPreset::BLINK_STYLE: |
549 return "blink_style"; | 553 return "blink_style"; |
550 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: | 554 case BackgroundTracingConfigImpl::CategoryPreset::CATEGORY_PRESET_UNSET: |
551 NOTREACHED(); | 555 NOTREACHED(); |
552 } | 556 } |
553 NOTREACHED(); | 557 NOTREACHED(); |
554 return ""; | 558 return ""; |
555 } | 559 } |
556 | 560 |
557 } // namspace content | 561 } // namspace content |
OLD | NEW |