summaryrefslogtreecommitdiffstats
path: root/content/renderer/devtools
diff options
context:
space:
mode:
authorzhenw <zhenw@chromium.org>2015-11-20 11:12:48 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-20 19:13:32 +0000
commit79cf61808b98e9cfcc70b3751c77cbccfd728a55 (patch)
tree642d8dbc7f8bfc8a7b5f612a8eef63889180ad06 /content/renderer/devtools
parent43c4ea7df059c4ddca7580c61947b4aecddc178d (diff)
downloadchromium_src-79cf61808b98e9cfcc70b3751c77cbccfd728a55.zip
chromium_src-79cf61808b98e9cfcc70b3751c77cbccfd728a55.tar.gz
chromium_src-79cf61808b98e9cfcc70b3751c77cbccfd728a55.tar.bz2
[Tracing] Use TracingController as the interface for tracing start/stop
Currently some places use TraceLog::SetEnabled directly, e.g. startup and shutdown tracing. We want to make them use TracingController's interface, so that tracing is started in the same standard way. Later when we start to support multiple tracing methods with clock sync in Chrome, those places will automatically benefit from it. For startup tracing, the place that starts tracing is before threads are ready. So we have to use TraceLog::SetEnabled first. And right after threads are ready, we call TracingController::StartTracing to enable other tracing agents. Startup tracing should be the only place that uses TraceLog::SetEnabled for the constraint mentioned. Other places should use TracingController's interface. Doc on how startup tracing works: https://docs.google.com/document/d/1A26E8bRJNiX7lmjyYcPGdNDJWcQ7cnOUbaXRpg8S8v0/edit?usp=sharing TEST normal startup tracing with default configuration: $ ./out/Debug/chrome --trace-config-file TEST startup tracing for memory infra: $ cat > /tmp/trace.config { "startup_duration": 5, "result_file": "/tmp/trace.json", "trace_config": { "included_categories": ["disabled-by-default-memory-infra"], "excluded_categories": ["*"], "memory_dump_config": { "triggers": [ {"mode":"light", "periodic_interval_ms": 50}, {"mode":"detailed", "periodic_interval_ms": 1000} ] } } } $ ./out/Debug/chrome --no-sandbox --trace-config-file=/tmp/trace.config TEST startup tracing on Android $ adb push /tmp/trace.config /data/local/chrome-trace-config.json Run Chrome on Android and the result file is in /sdcard/Download/. TEST shutdown tracing $ ./out/Debug/chrome --trace-shutdown BUG=542390 Review URL: https://codereview.chromium.org/1423003003 Cr-Commit-Position: refs/heads/master@{#360871}
Diffstat (limited to 'content/renderer/devtools')
-rw-r--r--content/renderer/devtools/devtools_agent.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/content/renderer/devtools/devtools_agent.cc b/content/renderer/devtools/devtools_agent.cc
index 93dfd84..3b2f47e 100644
--- a/content/renderer/devtools/devtools_agent.cc
+++ b/content/renderer/devtools/devtools_agent.cc
@@ -131,6 +131,12 @@ void DevToolsAgent::didExitDebugLoop() {
}
void DevToolsAgent::enableTracing(const WebString& category_filter) {
+ // Tracing is already started by DevTools TracingHandler::Start for the
+ // renderer target in the browser process. It will eventually start tracing in
+ // the renderer process via IPC. But we still need a redundant
+ // TraceLog::SetEnabled call here for
+ // InspectorTracingAgent::emitMetadataEvents(), at which point, we are not
+ // sure if tracing is already started in the renderer process.
TraceLog* trace_log = TraceLog::GetInstance();
trace_log->SetEnabled(
base::trace_event::TraceConfig(category_filter.utf8(), ""),