• Eric Rannaud's avatar
    [cpu-profile] Timestamps in tracing events args stay in monotonic time · 668aafb5
    Eric Rannaud authored
    On Linux, Perfetto translates the builtin "ts" timestamp in trace event
    from CLOCK_MONOTONIC to CLOCK_BOOTTIME, before passing them to devtools.
    Devtools therefore implicitly operates on timestamps that are in
    CLOCK_BOOTTIME.
    
    However, additional timestamps sent in trace event payload arguments
    will not be converted to CLOCK_BOOTTIME by Perfetto, raising the
    possibility of devtools using timestamps from multiple clock domains
    incorrectly.
    
    Since trace events sent by CpuProfile also include the builtin "ts"
    trace timestamp (sampled from CLOCK_MONOTONIC nearly at the same time by
    the tracing framework), sending "data.startTime" and "data.endTime" is
    essentially redundant. devtools-frontend:2113957 stops the use of the
    value of these timestamps in the payload of Profile and ProfileChunk
    events. Devtools continue to use the presence of these arguments to
    indentify start and end profile events.
    
    ProfileChunk events also include "timeDeltas" which are relative
    timestamps. They are also in CLOCK_MONOTONIC and are not translated by
    Perfetto. devtools-frontend:2113957 computes absolute CLOCK_BOOTTIME
    timestamps from timeDeltas by adding them to "ts" in the "Profile" event
    (previously, "data.startTime" was used). This is only valid if the
    system is not suspended/resumed during profiling. Providing support for
    suspend/resume in the middle of profiling will likely involve having
    Perfetto convert "timeDeltas" directly to CLOCK_BOOTTIME.
    
    This CL introduces no code changes and only adds comments to explain
    the above.
    
    BUG=chromium:1055871
    
    Change-Id: I649dfcce8ea1a100c0ecfe03f843c7cb1fdd6f33
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2114001
    Commit-Queue: Peter Marshall <petermarshall@chromium.org>
    Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#66820}
    668aafb5
AUTHORS 7.57 KB