• Sky Malice's avatar
    Revert "Redesign ATrace integration" · 5b3bf8df
    Sky Malice authored
    This reverts commit 80207c25.
    
    Reason for revert: Flaking tests, see crbug.com/1117683
    
    Original change's description:
    > Redesign ATrace integration
    >
    > Chrome and WebView have supported basic Android ATrace tracing, but the
    > current approach has some shortcomings:
    >
    > 1) Android R changes the way atrace session activations are broadcast,
    >    breaking the code in WebView listening for activations
    >    (OnTraceEnabledChangeListener). This means you can't trace a running
    >    WebView app with atrace.
    >
    > 2) Neither Chrome nor WebView record early startup events to atrace,
    >    which means all events before the native library has loaded are
    >    lost.
    >
    > 3) It's not possible to specify trace categories via atrace, which means
    >    we need more cumbersome alternative solutions (i.e., command line
    >    flags) for startup tracing.
    >
    > 4) Writing ATrace events is only supported in WebView.
    >
    > This patch reworks the ATrace integration to resolve these problems and
    > to align the Chrome and WebView implementations. In short, ATrace
    > session management is moved to the common (TraceEvent) layer, and Chrome
    > and WebView only differ by which trace tags they listen to (APP vs.
    > WEBVIEW).
    >
    > We also add a way to declare trace categories through per-app tags:
    >
    > $ atrace -a org.chromium.chrome,org.chromium.chrome/<category_filter>
    >
    > (Note that the plain package name without any category filters must
    > always appear in the list on its own.)
    >
    > Multiple categories can be separated with a double colon:
    >
    > $ atrace -a org.chromium.chrome,org.chromium.chrome/cat1:cat2
    >
    > Or by specifying the the app several times to get around the 91
    > character limit for each entry:
    >
    > $ atrace -a org.chromium.chrome,\
    >             org.chromium.chrome/cat1,\
    >             org.chromium.chrome/cat2
    >
    > Finally, to capture Java startup events into a tracing session
    > controlled by the system's Perfetto service instead of atrace, a
    > special "-atrace" category can be used to only write events into
    > Chrome's own tracing service instead of atrace. This way when we
    > connect to Perfetto later in the startup sequence and establish
    > the real tracing session, startup-related events can be flushed
    > into that session without emitting duplicate events into ATrace.
    >
    > # Basic trace while Chrome is running. Generates ATrace with Chrome
    > # events.
    > TEST=atrace -a org.chromium.chrome
    >
    > # Ditto for WebView.
    > TEST=atrace webview
    >
    > # Startup trace -- open Chrome after running this. Results in an ATrace
    > # with Chrome pre- and post-startup events.
    > TEST=atrace -a org.chromium.chrome
    >
    > # Ditto for WebView.
    > TEST=atrace webview
    >
    > # Trace with custom categories. Results in a ATrace with only
    > # "cc" events from Chrome.
    > TEST=atrace -a org.chromium.chrome,org.chromium.chrome/-*:cc
    >
    > # Ditto for WebView, using GMail as a test app.
    > TEST=atrace -a com.google.android.gm,com.google.android.gm/-*:cc webview
    >
    > # Chrome-only trace. No Chrome events written in the resulting ATrace.
    > TEST=atrace -a org.chromium.chrome,org.chromium.chrome/-atrace
    >
    > Bug: 1095587, b/160768681
    > Change-Id: Ia0bee252ce398804c00be8a4179241b75479bf5e
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332664
    > Reviewed-by: Bo <boliu@chromium.org>
    > Reviewed-by: Andrew Grieve <agrieve@chromium.org>
    > Reviewed-by: Eric Seckler <eseckler@chromium.org>
    > Commit-Queue: Bo <boliu@chromium.org>
    > Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#798791}
    
    TBR=boliu@chromium.org,skyostil@chromium.org,agrieve@chromium.org,eseckler@chromium.org,nuskos@chromium.org
    
    # Not skipping CQ checks because original CL landed > 1 day ago.
    
    Bug: 1095587, 1117683
    Bug: b/160768681
    Change-Id: Iffcaebb70c6eb92da1cb3080e8034ea5c36e5394
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363564
    Commit-Queue: Sky Malice <skym@chromium.org>
    Reviewed-by: default avatarSky Malice <skym@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#799456}
    5b3bf8df
trace_startup_config.cc 9.79 KB