• Lloyd Pique's avatar
    arc: Switch graphics tracing tool to use ARC_VSYNC · d54e5abb
    Lloyd Pique authored
    For displaying the vsync lines in the tool, we need the ideal vsync
    timestamps. The tool was using the timestamps of the HW_VSYNC_0 events,
    but this could be off and very jittery by several tenths of a
    millisecond from the vsync event time just because those events are
    written out by SurfaceFlinger when responding to the hardware composer
    vsync callback.
    
    The hardware composer vsync callback includes the actual vsync timestamp
    as an argument, but this is not included in the existing event trace in
    any way.
    
    I went and added a new ARC_VSYNC event which includes the actual vsync
    timestamp in the profile data, where it is stored in the string after
    the event name. Reading this event and parsing out the actual timestamp
    is much more accurate.
    
    Switching the tracing tool to using the event means that the vsync lines
    will be rendered with a consistent spacing, and represent the actual
    vsync times now, instead of lagging behind by some variable amount.
    
    Specifically this change
    
    1) Modifies arc_tracing_event_matcher to allow for a prefix match, and
       not just an exact name match. Since the timestamp is part of the name
       string and is variable, a prefix match was required to match these
       events.
    2) A unit test was added to cover the new matching behavior, and in
       implementing it I went ahead and added move constructors/assignment
       to ArcTracingEvent for convenience
    3) Removes "disabled-by-default-android hal" from the trace options when
       the tool is used. It turned out this was including some events from
       HIDL ("HIDL::IComposerCallback::onVsync::passthrough"), which were
       emitted using atrace_begin/atrace_end, however which could actually
       execute on separate threads and break an assumption in the tracing
       tool that they were emitted by the same thread. Perhaps the Android
       HAL generator code could be adjusted to use atrace_async_begin and
       atrace_async_end instead, but since we do not seem to need the HAL
       events, it was easier to just disable their capture.
    4) Switches the tracing model to look for the ARC_VSYNC events instead
       of the HW_VSYNC_0 events, including reading the timestamp out of the
       name string instead of using the misleading event timestamp.
    
    BUG=b:132641796
    TEST=unit_tests --gtest_filter=ArcTracingEventMatcherTest*
    TEST=chrome://arc-graphics-tracing
    
    Change-Id: I887a573c74035d783b918ca69c3dbb47fc1e5920
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811936
    Auto-Submit: Lloyd Pique <lpique@chromium.org>
    Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
    Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
    Commit-Queue: Lloyd Pique <lpique@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#702301}
    d54e5abb
arc_tracing_event.h 4.34 KB