tp: implement perfetto_metadata clock/machine overrides#6188
Closed
Conversation
Created using spr 1.3.7
🎨 Perfetto UI Builds
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the perfetto_metadata sidecar: a JSON file inside a zip/tar
archive which overrides clock and machine handling for the other files
in the archive, together with a comprehensive diff test suite covering
every green and error path of the v1 schema.
The schema (v1):
processed before all other archive members (including proto)
machine ({id}) and clocks (native, offset_ns XOR anchor)
units, e.g. us for JSON) paired with a value on a named builtin
clock or a utc wall time; the source clock is always implicit
names, unmatched/duplicated paths, mutually exclusive fields,
standalone (non-archive) usage and multiple config files
The implementation:
archive. The file does NOT fork a per-trace context: it produces no
events, and forking would create the per-machine state early and
steal 'primary' status from the real traces, isolating their clock
snapshots in private syncs.
new global TraceMetadataState. trace_time_clock is applied directly
on TraceTimeState with a sentinel owner id so no later trace file
can override it.
archive path: machine.id feeds ForkContextForTrace, clocks.native
remaps the format's declared clock (new ClockTracker remap consulted
in ToTraceTime), clocks.offset_ns becomes a per-file post-conversion
shift and clocks.anchor is injected as a snapshot into the machine's
shared ClockSynchronizer so it composes with snapshots from other
traces. For proto traces a clocks override also routes packets
without an explicit clock id through the trace default clock.
in practice; proto traces are checked optimistically and fail lazily
(a ClockSnapshot or a packet with machine_id != 0 proves multi-ness).
Entries whose path matches no archive member fail at end of file.
into SystraceLine: previously the conversion was only used as the
sorting key while tables were populated from the raw MONOTONIC
value. This was masked by identity conversions and only diverged
when a proto trace's snapshot actually linked MONOTONIC into the
clock graph.