Skip to content

tp: split clock tracker API into composable primitives#4807

Open
LalitMaganti wants to merge 14 commits intomainfrom
dev/lalitm/clock-3
Open

tp: split clock tracker API into composable primitives#4807
LalitMaganti wants to merge 14 commits intomainfrom
dev/lalitm/clock-3

Conversation

@LalitMaganti
Copy link
Member

@LalitMaganti LalitMaganti commented Feb 14, 2026

Split ClockTracker::SetTraceTimeClock into three composable primitives:

  • SetGlobalClock: sets the shared trace time clock. Errors if
    conversions already happened. Tracks ownership so only one trace
    file can set it.
  • SetTraceDefaultClock: sets the per-trace-file default clock, used
    as fallback when no timestamp_clock_id is specified. Only
    meaningful for proto traces.
  • AddDeferredIdentitySync: registers a clock for lazy identity-edge
    injection. On the first ToTraceTime call, if the registered clock
    isn't already in the clock graph, a 0:0 edge is added between it
    and the global trace time clock.

Also centralizes clock setup in ForwardingTraceParser::Init() so each
trace format sets its global clock there rather than in individual
tokenizers.

Proto traces defer clock setup: ForwardingTraceParser registers a
deferred identity sync for BOOTTIME, and ParseClockSnapshot later
calls SetGlobalClock + SetTraceDefaultClock when a clock snapshot
arrives.

Other cleanups: removes OnFirstTraceTimeUse/used_for_conversion
(replaced by num_conversions_), removes redundant primary_sync_
member, and fixes power_rails_multi_device diff test to include a
proper clock_snapshot.

This CL implements what was described at #4573
by making the ClockTracker per-trace + machine to avoid two traces with
clock snapshots from clashing with each other. Instead everyone only
uses the primary trace's clock snapshots if they don't have their own.
@LalitMaganti LalitMaganti requested a review from a team as a code owner February 14, 2026 04:19
@LalitMaganti LalitMaganti marked this pull request as draft February 14, 2026 04:23
@LalitMaganti LalitMaganti changed the title [dns] tp: improve clock sync in merged traces tp: refactor ClockId API and route all importers through clock conversion Feb 16, 2026
@LalitMaganti LalitMaganti changed the title tp: refactor ClockId API and route all importers through clock conversion tp: split clock tracker API into composable primitives Feb 16, 2026
@LalitMaganti LalitMaganti marked this pull request as ready for review February 16, 2026 19:46
Base automatically changed from dev/lalitm/clock to main February 17, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant