Commit 4bef3139 authored by Stephen Nusko's avatar Stephen Nusko Committed by Commit Bot

Register tracing data sources early if SystemTracing is enabled.

This ensures that all processes are available for tracing since the data
sources will be registered. Before only the browser process registered
data sources, and thus you had to run a local trace before a system
trace to get data from the renderer. This fixes that so all processes
will register the TraceEvent and TraceSampler data sources
(TraceMetadata remains browser only).

Since the trace processor doesn't support proto traces yet I can't write an
integration tests for this behaviour change.

Bug: 979576,1007275
Change-Id: Ibb5aed2725ed2eae3672a3fddd5a31db7804f247
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821602Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699823}
parent f7842dfc
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "components/tracing/common/tracing_switches.h" #include "components/tracing/common/tracing_switches.h"
#include "services/tracing/public/cpp/perfetto/trace_event_data_source.h" #include "services/tracing/public/cpp/perfetto/trace_event_data_source.h"
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h" #include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
#include "services/tracing/public/cpp/trace_event_agent.h"
#include "services/tracing/public/cpp/tracing_features.h" #include "services/tracing/public/cpp/tracing_features.h"
namespace tracing { namespace tracing {
...@@ -85,6 +86,8 @@ void InitTracingPostThreadPoolStartAndFeatureList() { ...@@ -85,6 +86,8 @@ void InitTracingPostThreadPoolStartAndFeatureList() {
// Below are the things tracing must do once per process. // Below are the things tracing must do once per process.
TraceEventDataSource::GetInstance()->OnTaskSchedulerAvailable(); TraceEventDataSource::GetInstance()->OnTaskSchedulerAvailable();
if (base::FeatureList::IsEnabled(features::kEnablePerfettoSystemTracing)) { if (base::FeatureList::IsEnabled(features::kEnablePerfettoSystemTracing)) {
// We have to ensure that we register all the data sources we care about.
TraceEventAgent::GetInstance();
// To ensure System tracing connects we have to initialize the process wide // To ensure System tracing connects we have to initialize the process wide
// state. This Get() call ensures that the constructor has run. // state. This Get() call ensures that the constructor has run.
PerfettoTracedProcess::Get(); PerfettoTracedProcess::Get();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment